Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Trouble with liftIO in ReaderT (John Smith) 2. Re: Trouble with liftIO in ReaderT (Daniel Fischer) 3. Re: Trouble with liftIO in ReaderT (John Smith) 4. Developing dependant libraries simultaneously (John Smith) ---------------------------------------------------------------------- Message: 1 Date: Sun, 30 Jan 2011 16:16:36 +0200 From: John Smith <volderm...@hotmail.com> Subject: [Haskell-beginners] Trouble with liftIO in ReaderT To: beginners@haskell.org Message-ID: <ii3rs5$vu6$1...@dough.gmane.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I'm trying to attach a handler to a Gtk2Hs event, and get the error: No instance for (Control.Monad.IO.Class.MonadIO (mtl-1.1.0.2:Control.Monad.Reader.ReaderT (GHC.Ptr.Ptr EAny) IO)) arising from a use of `liftIO' Possible fix: add an instance declaration for (Control.Monad.IO.Class.MonadIO (mtl-1.1.0.2:Control.Monad.Reader.ReaderT (GHC.Ptr.Ptr EAny) IO)) This occurs with the sample at http://www.haskell.org/haskellwiki/Gtk2Hs/Tutorials/Intro import Graphics.UI.Gtk import Control.Monad.Trans(liftIO) main = do initGUI window <- windowNew window `on` deleteEvent $ liftIO mainQuit >> return False -- i.e., on window deleteEvent (liftIO mainQuit >> return False) widgetShow window mainGUI Why can't GHC find the instance MonadIO m => MonadIO (ReaderT r m)? ------------------------------ Message: 2 Date: Sun, 30 Jan 2011 15:43:00 +0100 From: Daniel Fischer <daniel.is.fisc...@googlemail.com> Subject: Re: [Haskell-beginners] Trouble with liftIO in ReaderT To: beginners@haskell.org Cc: John Smith <volderm...@hotmail.com> Message-ID: <201101301543.01300.daniel.is.fisc...@googlemail.com> Content-Type: text/plain; charset="iso-8859-1" On Sunday 30 January 2011 15:16:36, John Smith wrote: > I'm trying to attach a handler to a Gtk2Hs event, and get the error: > > No instance for (Control.Monad.IO.Class.MonadIO > (mtl-1.1.0.2:Control.Monad.Reader.ReaderT > (GHC.Ptr.Ptr EAny) IO)) arising from a use of `liftIO' > Possible fix: > add an instance declaration for > (Control.Monad.IO.Class.MonadIO > (mtl-1.1.0.2:Control.Monad.Reader.ReaderT (GHC.Ptr.Ptr EAny) IO)) > > This occurs with the sample at > http://www.haskell.org/haskellwiki/Gtk2Hs/Tutorials/Intro > > import Graphics.UI.Gtk > import Control.Monad.Trans(liftIO) > > main = do > initGUI > window <- windowNew > window `on` deleteEvent $ liftIO mainQuit >> return False > -- i.e., on window deleteEvent (liftIO mainQuit >> return False) > widgetShow window > mainGUI > > Why can't GHC find the instance MonadIO m => MonadIO (ReaderT r m)? > GHC specifies the package the offending ReaderT comes from, mtl-1.1.0.2. mtl-1.1.0.2's ReaderT is an instance of mtl-1.1.0.2's MonadIO class. That class was defined in Control.Monad.Trans. Note that a) the package from which the MonadIO class in the error message comes is not specified, b) it is qualified as Control.Monad.IO.Class.MonadIO, it comes from a module of the transformers package. I suspect that your programme uses inconsistent dependencies, some part of it was built against mtl-1.1.0.2, some other part uses mtl-2.* (which is a wrapper around transformers, exporting mtl's old API [with a few differences]) or transformers directly. Check which mtl-version gtk2hs was built against ( $ ghc-pkg describe gtk , look at the depends field fairly low down), probably that was built against mtl-1.1.0.2. To fix it you can - maybe rebuild gtk2hs (gtk, glade, pango, ...) against mtl-2 [much compiling, may not work, but would save some headaches later if it does] - build your programme against mtl-1.1.0.2 (either by writing a .cabal file specifying mtl-1 or by passing -package mtl-1.1.0.2 on the command line). HTH, Daniel ------------------------------ Message: 3 Date: Sun, 30 Jan 2011 21:16:43 +0200 From: John Smith <volderm...@hotmail.com> Subject: Re: [Haskell-beginners] Trouble with liftIO in ReaderT To: beginners@haskell.org Message-ID: <ii4der$h4f$1...@dough.gmane.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 30/01/2011 16:43, Daniel Fischer wrote: > On Sunday 30 January 2011 15:16:36, John Smith wrote: >> I'm trying to attach a handler to a Gtk2Hs event, and get the error: >> >> No instance for (Control.Monad.IO.Class.MonadIO >> (mtl-1.1.0.2:Control.Monad.Reader.ReaderT >> (GHC.Ptr.Ptr EAny) IO)) arising from a use of `liftIO' >> Possible fix: >> add an instance declaration for >> (Control.Monad.IO.Class.MonadIO >> (mtl-1.1.0.2:Control.Monad.Reader.ReaderT (GHC.Ptr.Ptr EAny) IO)) >> >> This occurs with the sample at >> http://www.haskell.org/haskellwiki/Gtk2Hs/Tutorials/Intro >> >> import Graphics.UI.Gtk >> import Control.Monad.Trans(liftIO) >> >> main = do >> initGUI >> window<- windowNew >> window `on` deleteEvent $ liftIO mainQuit>> return False >> -- i.e., on window deleteEvent (liftIO mainQuit>> return False) >> widgetShow window >> mainGUI >> >> Why can't GHC find the instance MonadIO m => MonadIO (ReaderT r m)? >> > > GHC specifies the package the offending ReaderT comes from, mtl-1.1.0.2. > mtl-1.1.0.2's ReaderT is an instance of mtl-1.1.0.2's MonadIO class. That > class was defined in Control.Monad.Trans. > > Note that > a) the package from which the MonadIO class in the error message comes is > not specified, > b) it is qualified as Control.Monad.IO.Class.MonadIO, it comes from a > module of the transformers package. > > I suspect that your programme uses inconsistent dependencies, some part of > it was built against mtl-1.1.0.2, some other part uses mtl-2.* (which is a > wrapper around transformers, exporting mtl's old API [with a few > differences]) or transformers directly. > > Check which mtl-version gtk2hs was built against ( > $ ghc-pkg describe gtk > , look at the depends field fairly low down), probably that was built > against mtl-1.1.0.2. > > To fix it you can > - maybe rebuild gtk2hs (gtk, glade, pango, ...) against mtl-2 [much > compiling, may not work, but would save some headaches later if it does] > - build your programme against mtl-1.1.0.2 (either by writing a .cabal file > specifying mtl-1 or by passing -package mtl-1.1.0.2 on the command line). > > HTH, > Daniel I had mtl-1 as a system package, and mtl-2 as a user package. I forced the removal of mtl-1, reinstalled gtk (and a few other things), and it's working now. Thank you. ------------------------------ Message: 4 Date: Sun, 30 Jan 2011 22:42:58 +0200 From: John Smith <volderm...@hotmail.com> Subject: [Haskell-beginners] Developing dependant libraries simultaneously To: beginners@haskell.org Message-ID: <ii4igh$96b$1...@dough.gmane.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I am working on libraries A, B, and C simultaneously. B and C both depend on A. Whenever A changes, I have to rebuild an reinstall it for the changes to be picked up by B and C. Is there any way to tell cabal or GHC that B and C should import A, and check for changes when building? I'm using EclipseFP, but adding a project-reference does not appear to have any effect. ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 31, Issue 38 *****************************************