[Haskell-beginners] Is there a simpler way? Building a monad on `IO' Monad

Daniel Fischer daniel.is.fischer at googlemail.com
Sun Jan 9 13:43:16 CET 2011


On Sunday 09 January 2011 11:47:40, Arlen Cuss wrote:
> Hi all,
>
> Thanks for previous help on this list! I really appreciate it.
>
> Today I wrote a monad and I'm not sure if I took a complicated way about
> it. It's essentially a State monad, except with some specialised
> functions that operate on the `state' if you will (though the state is
> rarely mutated)

If it is not mutated at all (which seems not entirely unlikely with a pair 
(stdin,stdout) of Handles), you should use

ReaderT (Handle,Handle) IO

instead of

StateT (Handle,Handle) IO

btw.

Cheers,
Daniel



More information about the Beginners mailing list