[commit: packages/mtl] master: Use the implemention of modify' from transformers (e1b2542)

git at git.haskell.org git at git.haskell.org
Thu Aug 3 09:58:20 UTC 2017


Repository : ssh://git@git.haskell.org/mtl

On branch  : master
Link       : http://git.haskell.org/packages/mtl.git/commitdiff/e1b25421a980a37c08967a1c6c6e830f2256c0bf

>---------------------------------------------------------------

commit e1b25421a980a37c08967a1c6c6e830f2256c0bf
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Mon Jul 24 16:33:29 2017 -0400

    Use the implemention of modify' from transformers


>---------------------------------------------------------------

e1b25421a980a37c08967a1c6c6e830f2256c0bf
 CHANGELOG.markdown           | 2 ++
 Control/Monad/State/Class.hs | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown
index c9c26e2..16ef937 100644
--- a/CHANGELOG.markdown
+++ b/CHANGELOG.markdown
@@ -1,6 +1,8 @@
 2.2.2
 -----
 * `Control.Monad.Identity` now re-exports `Control.Monad.Trans.Identity`
+* Fix a bug in which `Control.Monad.State.Class.modify'` was not as strict in
+  the new state as its counterparts in `transformers`
 
 2.2.1
 -------
diff --git a/Control/Monad/State/Class.hs b/Control/Monad/State/Class.hs
index 23982cd..40ea931 100644
--- a/Control/Monad/State/Class.hs
+++ b/Control/Monad/State/Class.hs
@@ -91,8 +91,8 @@ modify f = state (\s -> ((), f s))
 -- new state.
 modify' :: MonadState s m => (s -> s) -> m ()
 modify' f = do
-  s' <- liftM f get
-  s' `seq` put s'
+  s' <- get
+  put $! f s'
 
 -- | Gets specific component of the state, using a projection function
 -- supplied.



More information about the ghc-commits mailing list