monad-control 1.0.0.5 → 1.0.1.0
raw patch · 4 files changed
+50/−4 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Monad.Trans.Control: type family StM m a :: *;
- Control.Monad.Trans.Control: }
+ Control.Monad.Trans.Control: captureM :: MonadBaseControl b m => m (StM m ())
+ Control.Monad.Trans.Control: captureT :: (MonadTransControl t, Monad (t m), Monad m) => t m (StT t ())
+ Control.Monad.Trans.Control: liftThrough :: (MonadTransControl t, Monad (t m), Monad m) => (m (StT t a) -> m (StT t b)) -> t m a -> t m b
- Control.Monad.Trans.Control: class MonadBase b m => MonadBaseControl b m | m -> b where type StM m a :: * where {
+ Control.Monad.Trans.Control: class MonadBase b m => MonadBaseControl b m | m -> b where type family StM m a :: *
- Control.Monad.Trans.Control: class MonadTrans t => MonadTransControl t where type StT t a :: * where {
+ Control.Monad.Trans.Control: class MonadTrans t => MonadTransControl t where type family StT t a :: *
Files
- CHANGELOG +15/−0
- Control/Monad/Trans/Control.hs +25/−3
- README.markdown +3/−0
- monad-control.cabal +7/−1
CHANGELOG view
@@ -1,3 +1,18 @@+1.0.1.0++* Added the functions:++ liftThrough+ :: (MonadTransControl t, Monad (t m), Monad m)+ => (m (StT t a) -> m (StT t b)) -- ^+ -> t m a -> t m b++ captureT :: (MonadTransControl t, Monad (t m), Monad m) => t m (StT t ())+ captureM :: MonadBaseControl b m => m (StM m ())++* Added Travis-CI integration++ 1.0.0.5 * Support transformers-0.5 & ransformers-compat-0.5.*.
Control/Monad/Trans/Control.hs view
@@ -29,23 +29,25 @@ ( -- * MonadTransControl MonadTransControl(..), Run - -- ** Defaults for MonadTransControl+ -- ** Defaults -- $MonadTransControlDefaults , RunDefault, defaultLiftWith, defaultRestoreT -- * MonadBaseControl , MonadBaseControl (..), RunInBase - -- ** Defaults for MonadBaseControl+ -- ** Defaults -- $MonadBaseControlDefaults , ComposeSt, RunInBaseDefault, defaultLiftBaseWith, defaultRestoreM -- * Utility functions- , control, embed, embed_+ , control, embed, embed_, captureT, captureM , liftBaseOp, liftBaseOp_ , liftBaseDiscard, liftBaseOpDiscard++ , liftThrough ) where @@ -464,6 +466,16 @@ embed_ f = liftBaseWith $ \runInBase -> return (void . runInBase . f) {-# INLINABLE embed_ #-} +-- | Capture the current state of a transformer+captureT :: (MonadTransControl t, Monad (t m), Monad m) => t m (StT t ())+captureT = liftWith $ \runInM -> runInM (return ())+{-# INLINABLE captureT #-}++-- | Capture the current state above the base monad+captureM :: MonadBaseControl b m => m (StM m ())+captureM = liftBaseWith $ \runInBase -> runInBase (return ())+{-# INLINABLE captureM #-}+ -- | @liftBaseOp@ is a particular application of 'liftBaseWith' that allows -- lifting control operations of type: --@@ -525,3 +537,13 @@ -> (a -> m ()) -> m c liftBaseOpDiscard f g = liftBaseWith $ \runInBase -> f $ void . runInBase . g {-# INLINABLE liftBaseOpDiscard #-}++-- | Transform an action in @t m@ using a transformer that operates on the underlying monad @m@+liftThrough+ :: (MonadTransControl t, Monad (t m), Monad m)+ => (m (StT t a) -> m (StT t b)) -- ^+ -> t m a -> t m b+liftThrough f t = do+ st <- liftWith $ \run -> do+ f $ run t+ restoreT $ return st
README.markdown view
@@ -1,3 +1,6 @@+[](https://hackage.haskell.org/package/monad-control)+[](https://travis-ci.org/basvandijk/monad-control)+ This package defines the type class `MonadControlIO`, a subset of `MonadIO` into which generic control operations such as `catch` can be lifted from `IO`. Instances are based on monad transformers in
monad-control.cabal view
@@ -1,5 +1,5 @@ Name: monad-control-Version: 1.0.0.5+Version: 1.0.1.0 Synopsis: Lift control operations, like exception catching, through monad transformers License: BSD3 License-file: LICENSE@@ -28,6 +28,12 @@ simplify and speedup most definitions. extra-source-files: README.markdown, CHANGELOG+tested-with:+ GHC==7.4.2,+ GHC==7.6.3,+ GHC==7.8.4,+ GHC==7.10.3,+ GHC==8.0.1 --------------------------------------------------------------------------------