[Haskell-cafe] lightweight alternative to mtl?

Roman Cheplyaka roma at ro-che.info
Sat Jun 16 16:57:18 CEST 2012


* Anton Kholomiov <anton.kholomiov at gmail.com> [2012-06-16 17:59:23+0400]
> It's class for strict and lazy states. Maybe it's better
> to take approach of containers (the same interface and different modules)?

The lazy and strict State monads differ only in their >>= operator.
Since you don't have control over importing the Monad instance, those
two have to be different types.

The reason why put/get/modify are in a class is to allow them to be used
not just with State, but also with any monad stack that has a State
inside, like `ReaderT e (State s)`.

-- 
Roman I. Cheplyaka :: http://ro-che.info/



More information about the Haskell-Cafe mailing list