[Haskell-cafe] more gtk help

Brandon Allbery allbery.b at gmail.com
Wed Aug 14 07:17:39 CEST 2013


On Tue, Aug 13, 2013 at 10:45 PM, <briand at aracnet.com> wrote:

> fooBar =
>     do putStrLn "foo"
>        return True
>
> so then I thought, aha!, all I need to do is understand the type of
> "return True" and all will be revealed to me.  Well, it's this:
>
>  Control.Monad.Trans.Reader.ReaderT
>        (GHC.Ptr.Ptr Gtk.EExpose) IO Bool
>
> just like the error message says.
>
> Still don't know what that's supposed to be.  I'm having trouble tracking
> down
>
> Control.Monad.Trans.Reader.ReaderT
>

In this case, all you need to know is the Control.Monad.Trans part and the
IO underneath; this tells you that you can use `lift` and possibly `liftIO`
to get at the IO.

    fooBar = do
        liftIO $ putStrLn "foo"
        return True

If `liftIO` complains about a missing MonadIO instance, file a bug :) but
you can also get there by using `lift` to reach it; in this case you only
need it once, but for more deeply nested transformers you may need it
multiple times (e.g. `lift . lift . lift $ putStrLn "foo"` for a stack of 3
transformers over IO).

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130814/15517ab4/attachment.htm>


More information about the Haskell-Cafe mailing list