mmorph 1.0.3 → 1.0.4
raw patch · 2 files changed
+19/−1 lines, 2 files
Files
- mmorph.cabal +1/−1
- src/Control/Monad/Morph.hs +18/−0
mmorph.cabal view
@@ -1,5 +1,5 @@ Name: mmorph-Version: 1.0.3+Version: 1.0.4 Cabal-Version: >= 1.8.0.2 Build-Type: Simple License: BSD3
src/Control/Monad/Morph.hs view
@@ -74,6 +74,9 @@ import Control.Monad.Trans.Class (MonadTrans(lift)) import qualified Control.Monad.Trans.Error as E+#if MIN_VERSION_transformers(0,4,0)+import qualified Control.Monad.Trans.Except as Ex+#endif import qualified Control.Monad.Trans.Identity as I import qualified Control.Monad.Trans.List as L import qualified Control.Monad.Trans.Maybe as M@@ -113,6 +116,11 @@ instance MFunctor (E.ErrorT e) where hoist nat m = E.ErrorT (nat (E.runErrorT m)) +#if MIN_VERSION_transformers(0,4,0)+instance MFunctor (Ex.ExceptT e) where+ hoist nat m = Ex.ExceptT (nat (Ex.runExceptT m))+#endif+ instance MFunctor I.IdentityT where hoist nat m = I.IdentityT (nat (I.runIdentityT m)) @@ -237,6 +245,16 @@ Left e -> Left e Right (Left e) -> Left e Right (Right a) -> Right a ) )++#if MIN_VERSION_transformers(0,4,0)+instance MMonad (Ex.ExceptT e) where+ embed f m = Ex.ExceptT (do + x <- Ex.runExceptT (f (Ex.runExceptT m))+ return (case x of+ Left e -> Left e+ Right (Left e) -> Left e+ Right (Right a) -> Right a ) )+#endif instance MMonad I.IdentityT where embed f m = f (I.runIdentityT m)