cps-except 0.0.1.1 → 0.0.1.2
raw patch · 2 files changed
+11/−1 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Control.Monad.CPSExcept: mapCPSExceptT :: (Monad m, Monad n) => (m (Either e a) -> n (Either e' b)) -> CPSExceptT e m a -> CPSExceptT e' n b
+ Control.Monad.CPSExcept: withExceptT :: Functor m => (e -> e') -> CPSExceptT e m a -> CPSExceptT e' m a
Files
- cps-except.cabal +1/−1
- src/Control/Monad/CPSExcept.hs +10/−0
cps-except.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: cps-except-version: 0.0.1.1+version: 0.0.1.2 synopsis: ExceptT replacement in CPS style license: BSD3 license-file: LICENSE
src/Control/Monad/CPSExcept.hs view
@@ -16,6 +16,16 @@ runCPSExceptT (CPSExceptT f) = f (pure . Left) (pure . Right) {-# INLINE runCPSExceptT #-} +mapCPSExceptT :: (Monad m, Monad n) =>+ (m (Either e a) -> n (Either e' b)) -> CPSExceptT e m a+ -> CPSExceptT e' n b+mapCPSExceptT f m = CPSExceptT $ \failC succesC ->+ either failC succesC =<< f (runCPSExceptT m)++withExceptT :: Functor m => (e -> e') -> CPSExceptT e m a -> CPSExceptT e' m a+withExceptT tr (CPSExceptT f) = CPSExceptT $ \failC succesC ->+ f (failC . tr) succesC+ instance Functor (CPSExceptT e m) where fmap f (CPSExceptT g) = CPSExceptT $ \failC successC -> g failC (successC . f)