control-monad-exception 0.1 → 0.1.1
raw patch · 2 files changed
+11/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Exception: evalEM :: EM l a -> a
+ Control.Monad.Exception: evalEMT :: (Monad m) => EMT l m a -> m a
Files
Control/Monad/Exception.hs view
@@ -17,6 +17,11 @@ newtype EM l a = EM {runEM::Either SomeException a} +-- | Run a safe computation+evalEM :: EM l a -> a+evalEM (EM (Right a)) = a+evalEM _ = error "evalEM : The impossible happened"+ instance Functor (EM l) where fmap f (EM (Left e)) = EM (Left e) fmap f (EM (Right x)) = EM (Right (f x))@@ -45,6 +50,11 @@ mplus p1@(EM Right{}) p2 = p1 newtype EMT l m a = EMT {runEMT :: m (Either SomeException a)}++evalEMT :: Monad m => EMT l m a -> m a+evalEMT (EMT m) = liftM f m where+ f (Right x) = x+ f (Left x) = error "evalEMT: The impossible happened" instance Monad m => Functor (EMT l m) where fmap f emt = EMT $ do
control-monad-exception.cabal view
@@ -1,5 +1,5 @@ name: control-monad-exception-version: 0.1+version: 0.1.1 Cabal-Version: >= 1.2.3 build-type: Simple license: PublicDomain