Combining IO and state monads

Ganesh Sittampalam ganesh@earth.li
Sat, 17 May 2003 12:30:11 +0100


On Fri, 16 May 2003 14:51:19 +0100, Graham Klyne <GK@ninebynine.org> wrote:

> What does the vertical bar "|" in the class declaration mean?  I can't find 
> this use mentioned in the Haskell report or the GHC type system extensions.

As someone else has already noted, this is a functional dependency. I'd just
like to note that if you want to stay within Haskell 98, it's still
perfectly possible to define the state monad transformer - all you lose is
the MonadState class.

Also, I strongly recommend the use of a record to keep your state - if you
use a tuple, then each time you add something new you'll have to change all
the getters and setters (or any other code that acts directly on the
structure of the state).

Cheers,

Ganesh