packages feed

control-monad-exception 0.3.1 → 0.3.2

raw patch · 3 files changed

+14/−9 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Control.Monad.Exception: instance [overlap ok] (Monad m, Throws MonadZeroException l) => MonadPlus (EMT l m)
+ Control.Monad.Exception: instance [overlap ok] (Throws MonadZeroException l) => MonadPlus (EM l)
+ Control.Monad.Exception.Class: instance [overlap ok] Typeable1 WrapException

Files

Control/Monad/Exception.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE UndecidableInstances #-}-{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverlappingInstances #-} @@ -37,7 +37,7 @@ mapLeft f (Left x)  = Left (f x) mapLeft _ (Right x) = Right x --- | Run a safe computation+-- | Run a computation explicitly handling exceptions evalEM :: EM (AnyException l) a -> Either SomeException a evalEM = runIdentity . evalEMT @@ -45,7 +45,7 @@ runEM :: EM NoExceptions a -> a runEM = runIdentity . runEMT --- | Run a safe computation+-- | Run a safe computation checking even unchecked (@UncaughtExceptions@) exceptions runEMParanoid :: EM ParanoidMode a -> a runEMParanoid = runIdentity . runEMTParanoid @@ -56,6 +56,7 @@  type AnyException = Caught SomeException +-- | Run explicitly handling exceptions evalEMT :: Monad m => EMT (AnyException l) m a -> m (Either SomeException a) evalEMT (EMT m) = mapLeft wrapException `liftM` m @@ -64,10 +65,11 @@   f (Right x) = x   f (Left  (WrapException (SomeException e))) = error (show e) +-- | Run a safe computation runEMT :: Monad m => EMT NoExceptions m a -> m a runEMT = runEMT_gen --- | Check even runtime (@UncaughtException@) exceptions+-- | Run a safe computation checking even unchecked (@UncaughtException@) exceptions runEMTParanoid :: Monad m => EMT ParanoidMode m a -> m a runEMTParanoid = runEMT_gen @@ -105,7 +107,7 @@                                Just e' -> unEMT (h e')  -instance (Monad m, Throws MonadZeroException l) => MonadPlus (EMT l m) where+instance (Throws MonadZeroException l) => MonadPlus (EM l) where   mzero = throw MonadZeroException   mplus emt1 emt2 = EMT$ do                      v1 <- unEMT emt1
Control/Monad/Exception/Class.hs view
@@ -31,6 +31,7 @@ import qualified Control.Exception #endif import Data.Monoid+import Data.Typeable import Prelude hiding (catch)  @@ -83,15 +84,17 @@ data ParanoidMode instance Private ParanoidMode --- | Uncaught Exceptions model runtime exceptions which are not checked.+-- | Uncaught Exceptions model unchecked exceptions (a la RuntimeException in Java) -----   In order to declare a runtime exception it must be made an instance of @UncaughtException@+--   In order to declare an unchecked exception @e@,+--   all that is needed is to make @e@ an instance of @UncaughtException@ class Exception e => UncaughtException e instance UncaughtException e => Throws e NoExceptions  -- Labelled SomeException -- -------------------------newtype WrapException l = WrapException {wrapException::SomeException} deriving Show+-- | @WrapException@ adds a phantom type parameter @l@ to @SomeException@+newtype WrapException l = WrapException {wrapException::SomeException} deriving (Show,Typeable)  -- Throw and Catch instances for the Either and ErrorT monads -- -----------------------------------------------------------
control-monad-exception.cabal view
@@ -1,5 +1,5 @@ name: control-monad-exception-version: 0.3.1+version: 0.3.2 Cabal-Version:  >= 1.2.3 build-type: Simple license: PublicDomain