On Tue, Aug 13, 2013 at 10:45 PM, <[email protected]> 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
[email protected] [email protected]
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe