Browse files

Fix horrible mistake in MonadState.state's default definition.

This is a trivial mistake in the sense that -Wall gives two
warnings about it:

      Warning: Defined but not used: `s'

      Warning: This binding for `s' shadows the existing binding
                 bound at Control/Monad/State/Class.hs:62:7

However, it caused a very hard-to-track bug in a completely
unrelated library (fb, which depends on http-conduit, which
depends on tls, which depends on mtl).
  • Loading branch information...
1 parent 05b0bf2 commit a60fc2695c5e1bfe72e564c53b88ef266957a00d @meteficha meteficha committed Apr 22, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 Control/Monad/State/Class.hs
4 Control/Monad/State/Class.hs
@@ -60,8 +60,8 @@ class Monad m => MonadState s m | m -> s where
state :: (s -> (a, s)) -> m a
state f = do
s <- get
- let ~(a, s) = f s
- put s
+ let ~(a, s') = f s
+ put s'
return a
-- | Monadic state transformer.

0 comments on commit a60fc26

Please sign in to comment.