transformers 0.6.1.2 → 0.6.2.0
raw patch · 8 files changed
+41/−42 lines, 8 filesdep ~ghc-prim
Dependency ranges changed: ghc-prim
Files
- Control/Monad/Trans/Accum.hs +14/−14
- Control/Monad/Trans/Cont.hs +3/−1
- Control/Monad/Trans/Except.hs +4/−10
- Control/Monad/Trans/Maybe.hs +2/−2
- Control/Monad/Trans/Reader.hs +3/−1
- Control/Monad/Trans/Select.hs +8/−10
- changelog +4/−0
- transformers.cabal +3/−4
Control/Monad/Trans/Accum.hs view
@@ -35,8 +35,7 @@ evalAccum, mapAccum, -- * The AccumT monad transformer- AccumT(AccumT),- runAccumT,+ AccumT(..), execAccumT, evalAccumT, mapAccumT,@@ -78,7 +77,8 @@ #endif -- ------------------------------------------------------------------------------ | An accumulation monad parameterized by the type @w@ of output to accumulate.+-- | An accumulation monad (non-strict) parameterized by the type @w@+-- of output to accumulate. -- -- This monad is a more complex extension of both the reader and writer -- monads. The 'return' function produces the output 'mempty', while @m@@ -145,20 +145,20 @@ -- In applications requiring only the ability to accumulate an output and -- to inspect the output so far, it would be considerably more efficient -- to use a state monad transformer.-newtype AccumT w m a = AccumT (w -> m (a, w))+--+-- @AccumT w m@ is strict if and only if @m@ is.+newtype AccumT w m a = AccumT {+ -- | Unwrap an accumulation computation. For example, in the call+ --+ -- @ (value, locals) <- runAccumT action globals@+ --+ -- the action is fed an initial environment @globals@, and @locals@ is+ -- the sum of all arguments to calls of 'add' executed by the action.+ runAccumT :: w -> m (a, w)+ } #if __GLASGOW_HASKELL__ >= 704 deriving (Generic) #endif---- | Unwrap an accumulation computation. For example, in the call------ @ (value, locals) <- runAccumT action globals@------ the action is fed an initial environment @globals@, and @locals@ is--- the sum of all arguments to calls of 'add' executed by the action.-runAccumT :: AccumT w m a -> w -> m (a, w)-runAccumT (AccumT f) = f-{-# INLINE runAccumT #-} -- | Extract the output from an accumulation computation. --
Control/Monad/Trans/Cont.hs view
@@ -64,7 +64,7 @@ #endif {- |-Continuation monad.+The continuation monad, which is non-strict. @Cont r a@ is a CPS ("continuation-passing style") computation that produces an intermediate result of type @a@ within a CPS computation whose final result type is @r@.@@ -139,6 +139,8 @@ -- -- 'ContT' is not a functor on the category of monads, and many operations -- cannot be lifted through it.+--+-- @ContT r m@ is strict if and only if @m@ is. newtype ContT r m a = ContT { runContT :: (a -> m r) -> m r } #if __GLASGOW_HASKELL__ >= 704 deriving (Generic)
Control/Monad/Trans/Except.hs view
@@ -36,8 +36,7 @@ mapExcept, withExcept, -- * The ExceptT monad transformer- ExceptT(ExceptT),- runExceptT,+ ExceptT(..), mapExceptT, withExceptT, -- * Exception operations@@ -79,7 +78,7 @@ import GHC.Generics #endif --- | The parameterizable exception monad.+-- | The parameterizable exception monad, which is strict. -- -- Computations are either exceptions (of any type) or normal values. -- These computations are plain values, and are unrelated to the@@ -119,7 +118,7 @@ -- | A monad transformer that adds exceptions to other monads. ----- @ExceptT@ constructs a monad parameterized over two things:+-- @ExceptT@ constructs a strict monad parameterized over two things: -- -- * e - An arbitrary exception type. --@@ -131,7 +130,7 @@ -- The 'return' function yields a computation that produces the given -- value, while @>>=@ sequences two subcomputations, exiting on the -- first exception.-newtype ExceptT e m a = ExceptT (m (Either e a))+newtype ExceptT e m a = ExceptT { runExceptT :: m (Either e a) } #if __GLASGOW_HASKELL__ >= 710 deriving (Generic, Generic1) #elif __GLASGOW_HASKELL__ >= 704@@ -169,11 +168,6 @@ readsPrec = readsPrec1 instance (Show e, Show1 m, Show a) => Show (ExceptT e m a) where showsPrec = showsPrec1---- | The inverse of 'ExceptT'.-runExceptT :: ExceptT e m a -> m (Either e a)-runExceptT (ExceptT m) = m-{-# INLINE runExceptT #-} -- | Map the unwrapped computation using the given function. --
Control/Monad/Trans/Maybe.hs view
@@ -69,8 +69,8 @@ import GHC.Generics #endif --- | The parameterizable maybe monad, obtained by composing an arbitrary--- monad with the 'Maybe' monad.+-- | The parameterizable maybe monad, a strict monad obtained by composing+-- an arbitrary monad with the 'Maybe' monad. -- -- Computations are actions that may produce a value or exit. --
Control/Monad/Trans/Reader.hs view
@@ -71,7 +71,7 @@ import GHC.Generics #endif --- | The parameterizable reader monad.+-- | The parameterizable reader monad, which is non-strict. -- -- Computations are functions of a shared environment. --@@ -122,6 +122,8 @@ -- -- <<images/bind-ReaderT.svg>> --+--+-- @ReaderT r m@ is strict if and only if @m@ is. newtype ReaderT r m a = ReaderT { runReaderT :: r -> m a } #if __GLASGOW_HASKELL__ >= 710 deriving (Generic, Generic1)
Control/Monad/Trans/Select.hs view
@@ -37,8 +37,7 @@ runSelect, mapSelect, -- * The SelectT monad transformer- SelectT(SelectT),- runSelectT,+ SelectT(..), mapSelectT, -- * Monad transformation selectToContT,@@ -58,7 +57,7 @@ import GHC.Generics #endif --- | Selection monad.+-- | The selection monad, which is non-strict. type Select r = SelectT r Identity -- | Constructor for computations in the selection monad.@@ -83,16 +82,15 @@ -- -- 'SelectT' is not a functor on the category of monads, and many operations -- cannot be lifted through it.-newtype SelectT r m a = SelectT ((a -> m r) -> m a)+--+-- @SelectT r m@ is strict if and only if @m@ is.+newtype SelectT r m a = SelectT {+ -- | Runs a @SelectT@ computation with a function for evaluating+ -- answers to select a particular answer.+ runSelectT :: (a -> m r) -> m a } #if __GLASGOW_HASKELL__ >= 704 deriving (Generic) #endif---- | Runs a @SelectT@ computation with a function for evaluating answers--- to select a particular answer. (The inverse of 'select'.)-runSelectT :: SelectT r m a -> (a -> m r) -> m a-runSelectT (SelectT g) = g-{-# INLINE runSelectT #-} -- | Apply a function to transform the result of a selection computation. -- This has a more restricted type than the @map@ operations for other
changelog view
@@ -1,5 +1,9 @@ -*-change-log-*- +0.6.2.0 Ross Paterson <R.Paterson@city.ac.uk> Apr 2025+ * Redefine runAccumT, runExceptT and runSelectT as fields+ * Document strictness of some transformers+ 0.6.1.2 Ross Paterson <R.Paterson@city.ac.uk> Sep 2024 * Portability fixes for MicroHs * Include image files in the bundle
transformers.cabal view
@@ -1,5 +1,5 @@ name: transformers-version: 0.6.1.2+version: 0.6.2.0 license: BSD3 license-file: LICENSE author: Andy Gill, Ross Paterson@@ -32,11 +32,10 @@ introduced by monad transformers through other transformers. build-type: Simple extra-doc-files:+ changelog images/bind-AccumT.svg images/bind-ReaderT.svg images/bind-WriterT.svg-extra-source-files:- changelog cabal-version: 1.18 source-repository head@@ -66,7 +65,7 @@ Data.Functor.Sum if impl(ghc>=7.2 && <7.5) -- Prior to GHC 7.5, GHC.Generics lived in ghc-prim- build-depends: ghc-prim+ build-depends: ghc-prim < 0.3 exposed-modules: Control.Applicative.Backwards Control.Applicative.Lift