[Haskell-beginners] State monad

Daniel Fischer daniel.is.fischer at googlemail.com
Tue Feb 15 13:48:46 CET 2011


On Monday 14 February 2011 19:23:43, Britt Anderson wrote:
> Actually, I can load the module and I have mtl. I just don't understand
> why I can use State as a data constructor, but the inverse of runState,
> i.e. state works just fine. Has this library/package been reconfigured
> from when most people were writing tutorials?

Exactly that. As of mtl-2.*, mtl is now a wrapper around transformers and 
no longer an independent library.
One change which broke a lot of tutorials (and some code) is that State is 
no longer a separate datatype. (State s) is now a type synonym for
(StateT s Identity), similarly for Reader, Writer. Those parts of the 
tutorials whcih don't use the data-constructor should work unchanged, 
though.



More information about the Beginners mailing list