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 wrote: From: Daniel Fischer Subject: Re: [Haskell-cafe] Intro to monad transformers To: haskell-cafe@haskell.org Cc: "michael rice" , "David Menendez

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: >  

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread michael rice
hen 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 wrote: From: David Menendez Subject: Re: [Haskell-cafe] Intro to monad transformers To: "michael rice" Cc: h

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 defi

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, 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 libr

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread David Menendez
On Sun, Dec 26, 2010 at 2:00 PM, michael rice 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 > Nothing

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 Antoine Latter
On Dec 26, 2010 2:01 PM, "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. > > Michael > I

Re: [Haskell-cafe] Intro to monad transformers

2010-12-26 Thread Stephen Tetley
On 26 December 2010 19:00, 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. > instance Mona

[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 Control.Monad.Trans.Cl