transformers 0.6.2.0 → 0.6.3.0
raw patch · 4 files changed
+28/−1 lines, 4 files
Files
- Control/Monad/Trans/Except.hs +9/−0
- Control/Monad/Trans/State/Lazy.hs +14/−0
- changelog +4/−0
- transformers.cabal +1/−1
Control/Monad/Trans/Except.hs view
@@ -45,6 +45,7 @@ handleE, tryE, finallyE,+ onE, -- * Lifting other operations liftCallCC, liftListen,@@ -328,6 +329,14 @@ closer either throwE return res {-# INLINE finallyE #-}++-- | If the first action succeeds, return its value, ignoring the+-- second action. If the first action throws an exception, run the+-- second action and then throw an exception, either the one thrown by+-- the second action, if any, or the one thrown by the first action.+onE :: (Monad m) => ExceptT e m a -> ExceptT e m b -> ExceptT e m a+onE action1 action2 = action1 `catchE` \ e -> action2 >> throwE e+{-# INLINE onE #-} -- | Lift a @callCC@ operation to the new monad. liftCallCC :: CallCC m (Either e a) (Either e b) -> CallCC (ExceptT e m) a b
Control/Monad/Trans/State/Lazy.hs view
@@ -64,6 +64,9 @@ liftCatch, liftListen, liftPass,+ -- * Conversion to and from the strict version+ strictToLazyStateT,+ lazyToStrictStateT, -- * Examples -- ** State monads -- $examples@@ -78,6 +81,7 @@ import Control.Monad.IO.Class import Control.Monad.Signatures import Control.Monad.Trans.Class+import qualified Control.Monad.Trans.State.Strict as Strict #if MIN_VERSION_base(4,12,0) import Data.Functor.Contravariant #endif@@ -357,6 +361,16 @@ ~((a, f), s') <- runStateT m s return ((a, s'), f) {-# INLINE liftPass #-}++-- | Convert from the strict version to the lazy version+strictToLazyStateT :: Strict.StateT s m a -> StateT s m a+strictToLazyStateT (Strict.StateT f) = StateT f+{-# INLINE strictToLazyStateT #-}++-- | Convert from the lazy version to the strict version+lazyToStrictStateT :: StateT s m a -> Strict.StateT s m a+lazyToStrictStateT (StateT f) = Strict.StateT f+{-# INLINE lazyToStrictStateT #-} {- $examples
changelog view
@@ -1,5 +1,9 @@ -*-change-log-*- +0.6.3.0 Ross Paterson <R.Paterson@city.ac.uk> Jan 2026+ * Add Control.Monad.Trans.Except.onE+ * Add strictToLazyState and lazyToStrictStateT+ 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
transformers.cabal view
@@ -1,5 +1,5 @@ name: transformers-version: 0.6.2.0+version: 0.6.3.0 license: BSD3 license-file: LICENSE author: Andy Gill, Ross Paterson