Monad composition

John Hughes
Thu, 24 Jan 2002 10:29:34 +0100 (MET)

The easiest way to combine State and IO is using a monad transformer. There
are some lecture notes which you might find useful at

which refer to a library module

Using this library you just build the type

	type StateIO s a = State s IO a

which is a monad with operations readState, writeState, and

	lift :: IO a -> StateIO s a