[Haskell-cafe] ANNOUNCE: monad-control-0.3

Bas van Dijk v.dijk.bas at gmail.com
Tue Dec 6 10:49:55 CET 2011


On 6 December 2011 05:06, Michael Snoyman <michael at snoyman.com> wrote:
> Maybe this will help[1]. It's using RWST instead of StateT, but it's
> the same idea.
>
> [1] https://github.com/yesodweb/yesod/commit/7619e4e9dd88c152d1e00b6fea073c3d52dc797f#L0R105

Hi Michael,

Note that you can just reuse the MonadTransControl instance of the
RWST transformer:

instance MonadTransControl (GGWidget master) where
    newtype StT (GGWidget master) a =
        StWidget {unStWidget :: StT (GWInner master) a}
    liftWith f = GWidget $ liftWith $ \run ->
                   f $ liftM StWidget . run . unGWidget
    restoreT = GWidget . restoreT . liftM unStWidget

Cheers,

Bas



More information about the Haskell-Cafe mailing list