packages feed

writer-cps-transformers 0.1.0.2 → 0.1.1.0

raw patch · 3 files changed

+58/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Trans.RWS.CPS: liftCallCC :: CallCC m (a, s, w) (b, s, w) -> CallCC (RWST r w s m) a b
+ Control.Monad.Trans.RWS.CPS: liftCallCC' :: CallCC m (a, s, w) (b, s, w) -> CallCC (RWST r w s m) a b
+ Control.Monad.Trans.RWS.CPS: liftCatch :: Catch e m (a, s, w) -> Catch e (RWST r w s m) a
+ Control.Monad.Trans.Writer.CPS: liftCallCC :: CallCC m (a, w) (b, w) -> CallCC (WriterT w m) a b
+ Control.Monad.Trans.Writer.CPS: liftCallCC' :: CallCC m (a, w) (b, w) -> CallCC (WriterT w m) a b
+ Control.Monad.Trans.Writer.CPS: liftCatch :: Catch e m (a, w) -> Catch e (WriterT w m) a

Files

Control/Monad/Trans/RWS/CPS.hs view
@@ -24,7 +24,7 @@ -----------------------------------------------------------------------------  module Control.Monad.Trans.RWS.CPS (-  -- * The RWS monda+  -- * The RWS monad   RWS,   rws,   runRWS,@@ -56,7 +56,11 @@   get,   put,   modify,-  gets+  gets,+  -- * Lifting other operations+  liftCallCC,+  liftCallCC',+  liftCatch, ) where  import Control.Applicative@@ -64,6 +68,7 @@ import Control.Monad.Fix import Control.Monad.IO.Class import Control.Monad.Trans.Class+import Control.Monad.Signatures import Data.Functor.Identity import Data.Monoid @@ -362,3 +367,24 @@ gets :: Monad m => (s -> a) -> RWST r w s m a gets f = RWST $ \_ s w -> return (f s, s, w) {-# INLINE gets #-}++-- | Uniform lifting of a @callCC@ operation to the new monad.+-- This version rolls back to the original state on entering the+-- continuation.+liftCallCC :: CallCC m (a,s,w) (b,s,w) -> CallCC (RWST r w s m) a b+liftCallCC callCC f = RWST $ \r s w ->+  callCC $ \c -> unRWST (f (\a -> RWST $ \_ _ w' -> c (a, s, w'))) r s w+{-# INLINE liftCallCC #-}++-- | In-situ lifting of a @callCC@ operation to the new monad.+-- This version uses the current state on entering the continuation.+liftCallCC' :: CallCC m (a,s,w) (b,s,w) -> CallCC (RWST r w s m) a b+liftCallCC' callCC f = RWST $ \r s w ->+  callCC $ \c -> unRWST (f (\a -> RWST $ \_ s' w' -> c (a, s', w'))) r s w+{-# INLINE liftCallCC' #-}++-- | Lift a @catchE@ operation to the new monad.+liftCatch :: Catch e m (a,s,w) -> Catch e (RWST r w s m) a+liftCatch catchE m h =+  RWST $ \r s w -> unRWST m r s w `catchE` \e -> unRWST (h e) r s w+{-# INLINE liftCatch #-}
Control/Monad/Trans/Writer/CPS.hs view
@@ -46,7 +46,11 @@   listen,   listens,   pass,-  censor+  censor,+  -- * Lifting other operations+  liftCallCC,+  liftCallCC',+  liftCatch, ) where  import Control.Applicative@@ -54,6 +58,7 @@ import Control.Monad.Fix import Control.Monad.IO.Class import Control.Monad.Trans.Class+import Control.Monad.Signatures import Data.Functor.Identity import Data.Monoid @@ -244,3 +249,24 @@   let wt = w `mappend` f w'   wt `seq` return (a, wt) {-# INLINE censor #-}++-- | Uniform lifting of a @callCC@ operation to the new monad.+-- This version rolls back to the original state on entering the+-- continuation.+liftCallCC :: CallCC m (a, w) (b, w) -> CallCC (WriterT w m) a b+liftCallCC callCC f = WriterT $ \w ->+  callCC $ \c -> unWriterT (f (\a -> WriterT $ \_ -> c (a, w))) w+{-# INLINE liftCallCC #-}++-- | In-situ lifting of a @callCC@ operation to the new monad.+-- This version uses the current state on entering the continuation.+-- It does not satisfy the uniformity property (see "Control.Monad.Signatures").+liftCallCC' :: CallCC m (a, w) (b, w) -> CallCC (WriterT w m) a b+liftCallCC' callCC f = WriterT $ \w ->+  callCC $ \c -> unWriterT (f (\a -> WriterT $ \w' -> c (a, w'))) w+{-# INLINE liftCallCC' #-}++-- | Lift a @catchE@ operation to the new monad.+liftCatch :: Catch e m (a, w) -> Catch e (WriterT w m) a+liftCatch catchE m h = WriterT $ \w -> unWriterT m w `catchE` \e -> unWriterT (h e) w+{-# INLINE liftCatch #-}
writer-cps-transformers.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.14.1.+-- This file has been generated from package.yaml by hpack version 0.15.0. -- -- see: https://github.com/sol/hpack  name:           writer-cps-transformers-version:        0.1.0.2+version:        0.1.1.0 license:        BSD3 license-file:   LICENSE tested-with:    GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1@@ -14,7 +14,7 @@ category:       Control homepage:       https://github.com/minad/writer-cps-transformers#readme synopsis:       WriteT and RWST monad transformers-description:    The WriterT and RWST monad transformers provided by writer-cps-transformers are written in continuation passing style and avoid the space-leak problem of the traditional Control.Monad.Trans.Writer.Strict/Lazy. The corresponding MTL class instances are in the package writer-cps-mtl (<https://hackage.haskell.org/package/writer-cps-mtl>).+description:    The WriterT and RWST monad transformers provided by writer-cps-transformers are written in continuation passing style and avoid the space-leak problem of the traditional Control.Monad.Trans.Writer.Strict and Control.Monad.Trans.Writer.Lazy. The corresponding MTL class instances are in the package writer-cps-mtl (<http://hackage.haskell.org/package/writer-cps-mtl>). build-type:     Simple cabal-version:  >= 1.10