packages feed

hw-polysemy 0.1.0.0 → 0.1.1.0

raw patch · 3 files changed

+108/−3 lines, 3 filesdep +contravariantdep +ghc-prim

Dependencies added: contravariant, ghc-prim

Files

hw-polysemy.cabal view
@@ -1,6 +1,6 @@ cabal-version:          3.4 name:                   hw-polysemy-version:                0.1.0.0+version:                0.1.1.0 synopsis:               Opinionated polysemy library description:            Opinionated polysemy library. license:                Apache-2.0@@ -20,7 +20,9 @@ common base                       { build-depends: base                       >= 4.18.2.1   && < 5      }  common bytestring                 { build-depends: bytestring                                  < 0.13   }+common contravariant              { build-depends: contravariant                               < 1.6    } common filepath                   { build-depends: filepath                                    < 1.6    }+common ghc-prim                   { build-depends: ghc-prim                                    < 0.12   } common hedgehog                   { build-depends: hedgehog                                    < 1.5    } common polysemy                   { build-depends: polysemy                                    < 2      } common polysemy-log               { build-depends: polysemy-log                                < 0.11   }@@ -49,7 +51,9 @@ library   import:               base, project-config,                         bytestring,+                        contravariant,                         filepath,+                        ghc-prim,                         hedgehog,                         polysemy,                         polysemy-log,@@ -61,6 +65,7 @@                         HaskellWorks.Polysemy.ByteString.Strict                         HaskellWorks.Polysemy.Data.String                         HaskellWorks.Polysemy.Either+                        HaskellWorks.Polysemy.Error                         HaskellWorks.Polysemy.Hedgehog                         HaskellWorks.Polysemy.Hedgehog.Assert                         HaskellWorks.Polysemy.Hedgehog.Effect.Hedgehog
+ src/HaskellWorks/Polysemy/Error.hs view
@@ -0,0 +1,20 @@+module HaskellWorks.Polysemy.Error+  ( onLeft+  , onNothing+  , onLeftM+  , onNothingM+  ) where++import           HaskellWorks.Polysemy.Prelude++onLeft :: Monad m => (e -> m a) -> Either e a -> m a+onLeft f = either f pure++onNothing :: Monad m => m b -> Maybe b -> m b+onNothing h = maybe h return++onLeftM :: Monad m => (e -> m a) -> m (Either e a) -> m a+onLeftM f action = onLeft f =<< action++onNothingM :: Monad m => m b -> m (Maybe b) -> m b+onNothingM h f = onNothing h =<< f
src/HaskellWorks/Polysemy/Prelude.hs view
@@ -1,7 +1,9 @@ module HaskellWorks.Polysemy.Prelude   ( Bool(..)+  , Char(..)   , Maybe(..)   , Either(..)+   , String   , Text   , ByteString@@ -10,35 +12,105 @@   , Int16   , Int32   , Int64+  , Integer   , Word   , Word8   , Word16   , Word32   , Word64+  , Float+  , Double   , FilePath+  , Void    , Eq(..)   , Ord(..)+  , Num(..)   , Show(..)+  , IsString(..)   , tshow +  , bool   , const++  , absurd+  , vacuous+   , either+  , lefts+  , rights+  , isLeft+  , isRight+  , fromLeft+  , fromRight+   , maybe+  , isJust+  , isNothing+  , fromMaybe+  , listToMaybe+  , maybeToList+  , catMaybes+  , mapMaybe+   , fst+  , flip   , snd   , id+  , seq+  , curry+  , uncurry+  , ($!)   , ($)   , (&)   , (.)   , (</>)    , void+  , mapM_+  , forM+  , forM_+  , sequence_+  , (=<<)+  , (>=>)+  , (<=<)+  , forever+  , join+  , msum+  , mfilter+  , filterM+  , foldM+  , foldM_+  , replicateM+  , replicateM_+  , guard+  , when+  , unless+  , liftM+  , liftM2+  , liftM3+  , liftM4+  , liftM5+  , ap+  , (<$!>) +  , (<$>)++  , (<**>)+  , liftA+  , liftA3+  , optional+  , asum+   , for_    , Monad(..)+  , MonadFail(..)+  , MonadPlus(..)   , Applicative(..)+  , Alternative(..)+  , Contravariant(..)+  , Divisible(..)   , Functor(..)   , Bifunctor(..)   , Semigroup(..)@@ -52,6 +124,8 @@   , HasCallStack   , withFrozenCallStack +  , Generic+   , IOException   , SomeException(..)   ) where@@ -62,10 +136,13 @@ import           Data.Bifunctor import           Data.Bool import           Data.ByteString+import           Data.Char import           Data.Either import           Data.Eq import           Data.Foldable import           Data.Function+import           Data.Functor.Contravariant+import           Data.Functor.Contravariant.Divisible import           Data.Int import           Data.Maybe import           Data.Monoid@@ -75,13 +152,16 @@ import           Data.Text import           Data.Traversable import           Data.Tuple+import           Data.Void import           Data.Word+import           GHC.Base+import           GHC.Generics+import           GHC.Num import           GHC.Stack import           System.FilePath-import           System.IO import           Text.Show -import qualified Data.Text           as T+import qualified Data.Text                            as T  tshow :: Show a => a -> Text tshow = T.pack . show