contstuff 0.3.0 → 0.3.1
raw patch · 2 files changed
+16/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.ContStuff: instance (LiftBase m a, Monad m) => LiftBase (EitherT r e m) a
+ Control.ContStuff: instance (Monad m, Stateful m) => Stateful (EitherT r e m)
+ Control.ContStuff: modifyEitherT :: (Functor m) => (r -> r) -> EitherT r e m ()
Files
- Control/ContStuff.hs +15/−1
- contstuff.cabal +1/−1
Control/ContStuff.hs view
@@ -22,7 +22,7 @@ -- ** Choice/nondeterminism ChoiceT(..), runChoiceT, findFirst, findAll, listChoiceT, listA, -- ** Exceptions- EitherT(..), runEitherT, evalEitherT,+ EitherT(..), runEitherT, evalEitherT, modifyEitherT, -- ** State StateT(..), runStateT, evalStateT, execStateT, -- ** Writer monads@@ -340,6 +340,12 @@ evalEitherT (EitherT c) = c (pure . Right) (pure . Left) +-- | Modify the result of an 'EitherT' computation along the way.++modifyEitherT :: Functor m => (r -> r) -> EitherT r e m ()+modifyEitherT f = EitherT $ \k _ -> fmap f (k ())++ --------- -- IdT -- ---------@@ -674,6 +680,8 @@ type Base (ChoiceT r i m) a = Base m a; base = lift . base instance (LiftBase m a, Monad m) => LiftBase (ContT r m) a where type Base (ContT r m) a = Base m a; base = lift . base+instance (LiftBase m a, Monad m) => LiftBase (EitherT r e m) a where+ type Base (EitherT r e m) a = Base m a; base = lift . base instance (LiftBase m a, Monad m) => LiftBase (StateT r s m) a where type Base (StateT r s m) a = Base m a; base = lift . base @@ -706,6 +714,12 @@ instance (Monad m, Stateful m) => Stateful (ContT r m) where type StateOf (ContT r m) = StateOf m+ get = lift get+ put = lift . put+ putLazy = lift . putLazy++instance (Monad m, Stateful m) => Stateful (EitherT r e m) where+ type StateOf (EitherT r e m) = StateOf m get = lift get put = lift . put putLazy = lift . putLazy
contstuff.cabal view
@@ -1,5 +1,5 @@ Name: contstuff-Version: 0.3.0+Version: 0.3.1 Category: Control, Monads Synopsis: Easy to use CPS-based monads Maintainer: Ertugrul Söylemez <es@ertes.de>