[Haskell-cafe] Request to review my attempt at understanding Monads

Jason Dusek jason.dusek at gmail.com
Tue Dec 29 03:03:43 EST 2009

2009/12/28 CK Kashyap <ck_kashyap at yahoo.com>:
> 1. Comments about the functions I've written

  Maybe your indentation was eaten by your mailer; but please
  indent the operations within a `do' block and the definitions
  under a `where'.

  You should make a `Functor' instance since monads are all
  functors (though the typeclass does not enforce this).

> 2. I've used the do notation at the bottom which is a result
> of my List being a Monad - are there any other benefits that
> comes in because of List being a Monad? What would MonadPlus
> provide me?

  You can use `guard' and `when' and other monadic operations.
  The `MonadPlus' instance gives you access to `msum'. It's not
  just about `do' notation :)

> 3. The comprehension syntax for Lists in Haskell - can that be
> used in anyway for other Monads?

  Not anymore, though Gofer used to allow "monad

Jason Dusek

More information about the Haskell-Cafe mailing list