IO StateTransformer with an escape clause

Ganesh Sittampalam ganesh@earth.li
Mon, 01 Sep 2003 14:52:19 +0100


On Tue, 26 Aug 2003 14:33:28 +1000, "Thomas L. Bevan"
<thomas_bevan@toll.com.au> wrote:

>Hi,
>
>I'd like some help building an IO StateTransformer which can be escaped midway 
>through without losing the state accummulated up to that point.
>I tried constructing a
> StateT s MaybeIO a monad but the state is lost when the rest of 
>the monad collapses.

How is your MaybeIO type constructed? If with a monad transformer, then you
could consider putting the MaybeT transformer outside the StateT transformer
(I think that should work).

Ganesh