composite-base 0.3.0.0 → 0.3.1.0
raw patch · 2 files changed
+20/−2 lines, 2 filesdep +exceptionsnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: exceptions
API changes (from Hackage documentation)
+ Control.Monad.Composite.Context: instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Control.Monad.Composite.Context.ContextT c m)
+ Control.Monad.Composite.Context: instance Control.Monad.Catch.MonadMask m => Control.Monad.Catch.MonadMask (Control.Monad.Composite.Context.ContextT c m)
+ Control.Monad.Composite.Context: instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Control.Monad.Composite.Context.ContextT c m)
Files
composite-base.cabal view
@@ -3,12 +3,12 @@ -- see: https://github.com/sol/hpack name: composite-base-version: 0.3.0.0+version: 0.3.1.0 synopsis: Shared utilities for composite-* packages. description: Shared helpers for the various composite packages. category: Records homepage: https://github.com/ConferHealth/composite#readme-author: Confer Health, Inc+author: Confer Health, Inc. maintainer: oss@confer.care copyright: 2017 Confer Health, Inc. license: BSD3@@ -22,6 +22,7 @@ ghc-options: -Wall -O2 build-depends: base >= 4.7 && < 5+ , exceptions , template-haskell , lens , monad-control@@ -46,6 +47,7 @@ ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N -fno-warn-orphans build-depends: base >= 4.7 && < 5+ , exceptions , template-haskell , lens , monad-control
src/Control/Monad/Composite/Context.hs view
@@ -12,6 +12,7 @@ import Control.Lens (Getter, view) import Control.Monad (MonadPlus(mzero, mplus)) import Control.Monad.Base (MonadBase(liftBase))+import Control.Monad.Catch (MonadThrow(throwM), MonadCatch(catch), MonadMask(mask, uninterruptibleMask)) import Control.Monad.Cont.Class (MonadCont(callCC)) import Control.Monad.Error.Class (MonadError(throwError, catchError)) import Control.Monad.Fail (MonadFail)@@ -131,3 +132,18 @@ instance MonadCont m => MonadCont (ContextT c m) where callCC f = ContextT $ \ r -> callCC $ \ c -> runContextT (f (ContextT . const . c)) r++instance MonadThrow m => MonadThrow (ContextT c m) where+ throwM e = ContextT $ \ r -> throwM e++instance MonadCatch m => MonadCatch (ContextT c m) where+ catch m h = ContextT $ \ r -> catch (runContextT m r) (\ e -> runContextT (h e) r)++instance MonadMask m => MonadMask (ContextT c m) where+ mask a = ContextT $ \e -> mask $ \u -> runContextT (a $ q u) e+ where q :: (m a -> m a) -> ContextT c' m a -> ContextT c' m a+ q u (ContextT b) = ContextT (u . b)+ uninterruptibleMask a =+ ContextT $ \e -> uninterruptibleMask $ \u -> runContextT (a $ q u) e+ where q :: (m a -> m a) -> ContextT c' m a -> ContextT c' m a+ q u (ContextT b) = ContextT (u . b)