transformers 0.6.0.4 → 0.6.0.5
raw patch · 4 files changed
+39/−10 lines, 4 filesdep ~base
Dependency ranges changed: base
Files
- Control/Monad/Trans/Class.hs +31/−9
- Control/Monad/Trans/State/Strict.hs +4/−0
- changelog +3/−0
- transformers.cabal +1/−1
Control/Monad/Trans/Class.hs view
@@ -58,14 +58,29 @@ -- -- * @'lift' (m >>= f) = 'lift' m >>= ('lift' . f)@ ----- Since 0.6.0.0 and for GHC 8.8 and later, the requirement that @t m@+-- Since 0.6.0.0 and for GHC 8.6 and later, the requirement that @t m@ -- be a 'Monad' is enforced by the implication constraint -- @forall m. 'Monad' m => 'Monad' (t m)@ enabled by the -- @QuantifiedConstraints@ extension.-#if __GLASGOW_HASKELL__ >= 808+--+-- === __Ambiguity error with GHC 9.0 to 9.2.2__+-- These versions of GHC have a bug+-- (<https://gitlab.haskell.org/ghc/ghc/-/issues/20582>)+-- which causes constraints like+--+-- @+-- (MonadTrans t, forall m. Monad m => Monad (t m)) => ...+-- @+--+-- to be reported as ambiguous. For transformers 0.6 and later, this can+-- be fixed by removing the second constraint, which is implied by the first.+#if __GLASGOW_HASKELL__ >= 806 class (forall m. Monad m => Monad (t m)) => MonadTrans t where #else--- prior to GHC 8.8 (base-4.13), the Monad class included fail+-- Prior to GHC 8.8 (base-4.13), the Monad class included fail.+-- GHC 8.6 (base-4.12) has MonadFailDesugaring on by default, so there+-- is no need for users defining monad transformers to define fail in+-- the Monad instance of the transformed monad. class MonadTrans t where #endif -- | Lift a computation from the argument monad to the constructed monad.@@ -108,16 +123,23 @@ {- $strict -A monad is said to be /strict/ if its '>>=' operation is strict in its first-argument. The base monads 'Maybe', @[]@ and 'IO' are strict:+A monad is said to be /strict/ if its '>>=' operation (and therefore also+'>>') is strict in its first argument. The base monads 'Maybe', @[]@+and 'IO' are strict: ->>> undefined >> return 2 :: Maybe Integer+>>> undefined >> Just 2 *** Exception: Prelude.undefined+>>> undefined >> [2]+*** Exception: Prelude.undefined+>>> undefined >> print 2+*** Exception: Prelude.undefined -However the monad 'Data.Functor.Identity.Identity' is not:+However the monads 'Data.Functor.Identity.Identity' and @(->) a@ are not: ->>> runIdentity (undefined >> return 2)-2+>>> undefined >> Identity 2+Identity 2+>>> (undefined >> (+1)) 5+6 In a strict monad you know when each action is executed, but the monad is not necessarily strict in the return value, or in other components
Control/Monad/Trans/State/Strict.hs view
@@ -291,6 +291,10 @@ -- new state. -- -- * @'modify'' f = 'get' >>= (('$!') 'put' . f)@+--+-- Note that this is only strict in the top level of the state.+-- Lazy components of the state will not be evaluated unless @f@+-- evaluates them. modify' :: (Monad m) => (s -> s) -> StateT s m () modify' f = do s <- get
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +0.6.0.5 Ross Paterson <R.Paterson@city.ac.uk> Jan 2023+ * Revert to allowing MonadTrans constraint with GHC >= 8.6+ 0.6.0.4 Ross Paterson <R.Paterson@city.ac.uk> Feb 2022 * Restrict deriving (Generic) to GHC >= 7.4
transformers.cabal view
@@ -1,5 +1,5 @@ name: transformers-version: 0.6.0.4+version: 0.6.0.5 license: BSD3 license-file: LICENSE author: Andy Gill, Ross Paterson