[Haskell-cafe] Intro to monad transformers

2010-12-26 Thread michael rice
I lifted the code below from here: http://en.wikibooks.org/wiki/Haskell/Monad_transformers Since the wiki page doesn't say what needs to be imported, I'm guessing. Not sure what is happening. Maybe someone can tell me. Michael == import Control.Monad import

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Stephen Tetley
On 26 December 2010 19:00, michael rice nowg...@yahoo.com wrote: I lifted the code below from here: http://en.wikibooks.org/wiki/Haskell/Monad_transformers Since the wiki page doesn't say what needs to be imported, I'm guessing. Not sure what is happening. Maybe someone can tell me.

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Antoine Latter
On Dec 26, 2010 2:01 PM, michael rice nowg...@yahoo.com wrote: I lifted the code below from here: http://en.wikibooks.org/wiki/Haskell/Monad_transformers Since the wiki page doesn't say what needs to be imported, I'm guessing. Not sure what is happening. Maybe someone can tell me.

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Stephen Tetley
instance Monad m = MonadPlus (MaybeT m) where mzero = MaybeT $ return Nothing mplus x y = MaybeT $ do maybe_value - runMaybeT x case maybe_value of Nothing- runMaybeT y Just _ -

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread David Menendez
On Sun, Dec 26, 2010 at 2:00 PM, michael rice nowg...@yahoo.com wrote: instance Monad m = MonadPlus (MaybeT m) where mzero = MaybeT $ return Nothing mplus x y = MaybeT $ do maybe_value - runMaybeT x case maybe_value of

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Henning Thielemann
On Sun, 26 Dec 2010, Antoine Latter wrote: I haven't had a chance to dig into your example, but you might want to try the maybeT library: http://hackage.haskell.org/package/MaybeT That way you could try to narrow down where the error is coming from. MaybeT is also part of transformers

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Daniel Fischer
On Sunday 26 December 2010 20:00:02, michael rice wrote: I lifted the code below from here: http://en.wikibooks.org/wiki/Haskell/Monad_transformers Since the wiki page doesn't say what needs to be imported, I'm guessing. Not sure what is happening. Maybe someone can tell me. It loops

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Henning Thielemann
On Sun, 26 Dec 2010, David Menendez wrote: instance Show (MaybeT m a) This is never valid. You've defined show, shows, and showsPrec in terms of each other, creating unbounded recursion. Delete it. Unfortunately, the -Wall option of GHC won't help here, since all the methods are

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread michael rice
generalising the type(s) for `mplus'     In the instance declaration for `MonadPlus (MaybeT m)' Failed, modules loaded: none. --- On Sun, 12/26/10, David Menendez d...@zednenem.com wrote: From: David Menendez d...@zednenem.com Subject: Re: [Haskell-cafe] Intro to monad transformers To: michael

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Daniel Fischer
On Sunday 26 December 2010 21:21:00, michael rice wrote: Ok, changed the last line and deleted the bad line. Maybe someone could recommend a better example? Michael = Prelude :l test5 [1 of 1] Compiling Main ( test5.hs, interpreted ) test5.hs:16:4:     Occurs

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread michael rice
Ok, that works. On to code reading and, hopefully, enlightenment. Thanks, all. Michael --- On Sun, 12/26/10, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: From: Daniel Fischer daniel.is.fisc...@googlemail.com Subject: Re: [Haskell-cafe] Intro to monad transformers To: haskell-cafe