packages feed

catch-fd 0.1.0.1 → 0.1.0.2

raw patch · 4 files changed

+81/−24 lines, 4 filesdep ~basedep ~mtldep ~transformerssetup-changedPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, mtl, transformers

API changes (from Hackage documentation)

- Control.Monad.Catch: class (MonadThrow e m, Monad n) => MonadCatch e m n | m -> e, n e -> m
+ Control.Monad.Catch: class (MonadThrow e m, Monad n) => MonadCatch e m n | n e -> m

Files

Control/Monad/Catch.hs view
@@ -1,7 +1,12 @@+{-# LANGUAGE CPP #-}+#ifdef LANGUAGE_ConstraintKinds+{-# LANGUAGE ConstraintKinds #-}+#endif+#ifdef LANGUAGE_DefaultSignatures+{-# LANGUAGE DefaultSignatures #-}+#endif {-# LANGUAGE-    ConstraintKinds-  , DefaultSignatures-  , FlexibleInstances+    FlexibleInstances   , FunctionalDependencies   , MultiParamTypeClasses   , UndecidableInstances #-}@@ -27,8 +32,9 @@ thrown exception (see @'mapE'@).  [Zero and plus:]-Zero is represented by an empty error, and the plus operation executes its second-argument if the first fails (same as @'Control.Monad.Error.Class.MonadError'@).+Zero is represented by an empty error, and the plus operation executes its+second argument if the first fails (same as+@'Control.Monad.Error.Class.MonadError'@).  [Example type:] @'Either' 'String' a@@@ -63,7 +69,7 @@  import Data.Monoid -import Prelude (Either (..), IO, ($), (.), either, id)+import Prelude (Either (..), IO, ($), (.), either)  {- | The strategy of combining computations that can throw exceptions.@@ -76,14 +82,16 @@ class Monad m => MonadThrow e m | m -> e where   {- |   Is used within a monadic computation to begin exception processing.  If-  @('MonadThrow' e n, 'MonadTrans' t) => t n ~ m@, then @'throw' = 'lift' '.' 'throw'@-  is the default definition.+  @('MonadThrow' e n, 'MonadTrans' t) => t n ~ m@, then @'throw' = 'lift' '.'+  'throw'@ is the default definition.   -}   throw :: e -> m a+#ifdef LANGUAGE_DefaultSignatures   default throw :: (MonadThrow e m, MonadTrans t) => e -> t m a   throw = lift . throw+#endif -{-|+{- | The strategy of combining computations that can handle thrown exceptions, as well as throwing exceptions in the original computation. @@ -92,9 +100,7 @@ type constructor commonly differs from the original monad type constructor due to a change in the type of the error information. -}-class ( MonadThrow e m-      , Monad n-      ) => MonadCatch e m n | m -> e, n e -> m where+class (MonadThrow e m, Monad n) => MonadCatch e m n | n e -> m where   {- |   A handler function to handle thrown values and return to normal execution.   A common idiom is:@@ -106,7 +112,12 @@   -}   catch :: m a -> (e -> n a) -> n a +#ifdef LANGUAGE_ConstraintKinds type MonadError e m = (MonadThrow e m, MonadCatch e m m)+#else+class (MonadThrow e m, MonadCatch e m m) => MonadError e m+instance (MonadThrow e m, MonadCatch e m m) => MonadError e m+#endif  -- | Map the thrown value using the given function mapE :: (MonadCatch e m n, MonadThrow e' n) => (e -> e') -> m a -> n a@@ -132,63 +143,93 @@   m `catch` h = ErrorT $ runErrorT m >>= either (runErrorT . h) (return . Right)  instance MonadThrow e m => MonadThrow e (IdentityT m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance MonadCatch e m n => MonadCatch e (IdentityT m) (IdentityT n) where   m `catch` h = IdentityT $ runIdentityT m `catch` (runIdentityT . h)  instance MonadThrow e m => MonadThrow e (ListT m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance MonadCatch e m n => MonadCatch e (ListT m) (ListT n) where   m `catch` h = ListT $ runListT m `catch` \ e -> runListT (h e)  instance MonadThrow e m => MonadThrow e (MaybeT m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance MonadCatch e m n => MonadCatch e (MaybeT m) (MaybeT n) where   m `catch` h = MaybeT $ runMaybeT m `catch` (runMaybeT . h)  instance MonadThrow e m => MonadThrow e (ReaderT r m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance MonadCatch e m n => MonadCatch e (ReaderT r m) (ReaderT r n) where   m `catch` h =     ReaderT $ \ r -> runReaderT m r `catch` \ e -> runReaderT (h e) r  instance (Monoid w, MonadThrow e m) => MonadThrow e (LazyRWS.RWST r w s m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance (Monoid w, MonadCatch e m n) =>          MonadCatch e (LazyRWS.RWST r w s m) (LazyRWS.RWST r w s n) where   m `catch` h = LazyRWS.RWST $ \ r s ->     LazyRWS.runRWST m r s `catch` \ e -> LazyRWS.runRWST (h e) r s  instance (Monoid w, MonadThrow e m) => MonadThrow e (StrictRWS.RWST r w s m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance (Monoid w, MonadCatch e m n) =>          MonadCatch e (StrictRWS.RWST r w s m) (StrictRWS.RWST r w s n) where   m `catch` h = StrictRWS.RWST $ \ r s ->     StrictRWS.runRWST m r s `catch` \ e -> StrictRWS.runRWST (h e) r s  instance MonadThrow e m => MonadThrow e (LazyState.StateT s m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance MonadCatch e m n =>          MonadCatch e (LazyState.StateT s m) (LazyState.StateT s n) where   m `catch` h = LazyState.StateT $ \ s ->     LazyState.runStateT m s `catch` \ e -> LazyState.runStateT (h e) s  instance MonadThrow e m => MonadThrow e (StrictState.StateT s m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance MonadCatch e m n =>          MonadCatch e (StrictState.StateT s m) (StrictState.StateT s n) where   m `catch` h = StrictState.StateT $ \ s ->     StrictState.runStateT m s `catch` \ e -> StrictState.runStateT (h e) s  instance (Monoid w, MonadThrow e m) => MonadThrow e (LazyWriter.WriterT w m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance   ( Monoid w   , MonadCatch e m n   ) => MonadCatch e (LazyWriter.WriterT w m) (LazyWriter.WriterT w n) where   m `catch` h =     LazyWriter.WriterT $-    LazyWriter.runWriterT m `catch` \ e -> LazyWriter.runWriterT (h e)+    LazyWriter.runWriterT m `catch` (LazyWriter.runWriterT . h)  instance (Monoid w, MonadThrow e m) => MonadThrow e (StrictWriter.WriterT w m)+#ifndef LANGUAGE_DefaultSignatures+  where throw = lift . throw+#endif instance   ( Monoid w   , MonadCatch e m n   ) => MonadCatch e (StrictWriter.WriterT w m) (StrictWriter.WriterT w n) where   m `catch` h =     StrictWriter.WriterT $-    StrictWriter.runWriterT m `catch` \ e -> StrictWriter.runWriterT (h e)+    StrictWriter.runWriterT m `catch` (StrictWriter.runWriterT . h)  newtype WrappedMonadError m a =   WrapMonadError { unwrapMonadError :: m a
− Setup.hs
@@ -1,6 +0,0 @@-module Main (main) where--import Distribution.Simple (defaultMain)--main :: IO ()-main = defaultMain
+ Setup.lhs view
@@ -0,0 +1,7 @@+#!/usr/bin/env runhaskell+> module Main (main) where++> import Distribution.Simple (defaultMain)++> main :: IO ()+> main = defaultMain
catch-fd.cabal view
@@ -1,6 +1,6 @@ name:                catch-fd-version:             0.1.0.1-cabal-version:       >= 1.6+version:             0.1.0.2+cabal-version:       >= 1.10 synopsis:            MonadThrow and MonadCatch, using functional dependencies description:         MonadThrow and MonadCatch, using functional dependencies license:             BSD3@@ -17,6 +17,21 @@   location: git://github.com/sonyandy/catch-fd.git  library-  exposed-modules: Control.Monad.Catch -  build-depends: base < 6, mtl == 2.1.*, transformers == 0.3.*+  default-language: Haskell98+  exposed-modules: Control.Monad.Catch+  build-depends:+    base >= 4 && < 5,+    transformers >= 0.2 && < 0.4,+    mtl >= 2.0 && < 2.2+  other-extensions: CPP+  if impl(ghc >= 7.4)+    cpp-options: -DLANGUAGE_ConstraintKinds+    other-extensions: ConstraintKinds+  if impl(ghc >= 7.2)+    cpp-options: -DLANGUAGE_DefaultSignatures+  other-extensions:+    FlexibleInstances+    FunctionalDependencies+    MultiParamTypeClasses+    UndecidableInstances   ghc-options: -Wall