packages feed

pipes-errors 0.1 → 0.2

raw patch · 6 files changed

+57/−19 lines, 6 files

Files

+ CHANGELOG view
@@ -0,0 +1,9 @@+0.2+---+* Add `flipEP`.+* Move orphan instances to a single module.+* `Pipes.Lift.Error` re-exports all modules.++0.1+---+* Initial release.
Pipes/Lift/EitherRT.hs view
@@ -1,8 +1,7 @@-{-# OPTIONS_GHC -fno-warn-orphans #-} module Pipes.Lift.EitherRT where  import Control.Monad ((>=>))-import Pipes (Proxy, MFunctor, lift, hoist)+import Pipes (Proxy, lift) import Pipes.Lift (distribute) import Pipes.Internal (unsafeHoist) import Control.Error@@ -14,9 +13,6 @@   , flipE   ) import Pipes.Lift.EitherT--instance MFunctor (EitherRT r) where-    hoist nat m = EitherRT (hoist nat (runEitherRT m))  -- | Turn 'EitherT' in the base monad into 'EitherRT' eitherRP :: Monad m
Pipes/Lift/EitherT.hs view
@@ -1,25 +1,30 @@-{-# OPTIONS_GHC -fno-warn-orphans #-} module Pipes.Lift.EitherT where  import Control.Monad ((>=>))-import Pipes (Proxy, MFunctor, hoist, lift)+import Pipes (Proxy, lift) import Pipes.Lift (distribute) import Pipes.Internal (unsafeHoist)-import Control.Error (EitherT(..), runEitherT)--instance MFunctor (EitherT e) where-    hoist nat m = EitherT (nat (runEitherT m))+import Control.Error (EitherT(..), runEitherT, flipE)+import Pipes.Lift.Error.Instances () --- | Wrap the base monad in 'EitherT'+-- | Wrap the base monad in 'EitherT'. eitherP :: Monad m         => Proxy a' a b' b m (Either e r)         -> Proxy a' a b' b (EitherT e m) r eitherP = unsafeHoist lift >=> lift . EitherT . return {-# INLINABLE eitherP #-} --- | Run 'EitherT' in the base monad+-- | Run 'EitherT' in the base monad. runEitherP :: Monad m            => Proxy a' a b' b (EitherT e m) r            -> Proxy a' a b' b m (Either e r) runEitherP = runEitherT . distribute {-# INLINABLE runEitherP #-}++-- | Flip the type variables in the 'EitherT' base monad.+flipEP :: Monad m+       => Proxy a' a b' b (EitherT a m) b+       -> Proxy a' a b' b (EitherT b m) a+flipEP = unsafeHoist lift . runEitherT . distribute+     >=> lift . EitherT . return . flipE+{-# INLINABLE flipEP #-}
+ Pipes/Lift/Error.hs view
@@ -0,0 +1,9 @@+module Pipes.Lift.Error+  (+  -- * Re-exports+    module Pipes.Lift.EitherT+  , module Pipes.Lift.EitherRT+  ) where++import Pipes.Lift.EitherT+import Pipes.Lift.EitherRT
+ Pipes/Lift/Error/Instances.hs view
@@ -0,0 +1,11 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Pipes.Lift.Error.Instances where++import Pipes (MFunctor, hoist)+import Control.Error (EitherT(..), EitherRT(..), runEitherT)++instance MFunctor (EitherT e) where+    hoist nat m = EitherT (nat (runEitherT m))++instance MFunctor (EitherRT r) where+    hoist nat m = EitherRT (hoist nat (runEitherRT m))
pipes-errors.cabal view
@@ -1,6 +1,7 @@ name:                pipes-errors-version:             0.1+version:             0.2 cabal-version:       >=1.10+tested-with:         GHC == 7.6.3 build-type:          Simple license:             BSD3 license-file:        LICENSE@@ -11,17 +12,24 @@ category:            Control, Monad, Pipes, Error Handling synopsis:            Integration between pipes and errors description:-  This package provides orphan `MFunctor` instances for `EitherT` and-  `EitherRT`, in addition to functions for base monad manipulation in the-  presence of `Proxy` monad transformers.+  This package is analogous to the+  @<http://hackage.haskell.org/package/errors errors>@ package but for+  base monad manipulation in the presence of `Proxy` monad transformers. +  It also provides orphan `MFunctor` instances for `EitherT` and+  `EitherRT`.++extra-source-files: CHANGELOG+ source-repository head   type: git   location: https://github.com/jdnavarro/pipes-errors  library-  exposed-modules:     Pipes.Lift.EitherT-                       Pipes.Lift.EitherRT+  exposed-modules:     Pipes.Lift.Error+                     , Pipes.Lift.Error.Instances+                     , Pipes.Lift.EitherT+                     , Pipes.Lift.EitherRT   build-depends:       base >=4.6 && <4.8,                        errors >=1.3,                        pipes >=4.0