Here's a clearer description:
class Monad m where
    return :: a -> m a
    (>>=) :: m a -> (a -> m b) -> m b

Instances of Monad must satisfy the following laws:
  return a >>= k == k a
  m >>= return == m
  m >>= (k >>= h) == (m >>= k) >>= h

Much more clear and concise, don't you think?

On Wed, Apr 22, 2009 at 6:21 AM, Daniel Carrera <daniel.carrera@theingots.org> wrote:
I hate monads.

I love 90% of Haskell. The functional stuff is beautiful, easy to understand, crystal clear, elegant, etc. But I'm having a mighty hard time getting my head around monads. Consider the following explanation of a monad:

"A monad is represented as a type constructor (call it m), a function that builds values of that type (a -> m a), and a function that combines values of that type with computations that produce values of that type to produce a new computation for values of that type".

1) I know what a type is, but not a "type constructor". I don't normally think of an Int or even a complex type as being "constructed" except in the sense of OOP which I know is not what the author means.

2) Just *read* the paragraph... "a type constructor, a function that builds value of that type, and a function that combines values of that type with computations that produce values of that type to produce a computation of values of that type"   Ugh....


Can anyone recommend a simple and clear explanation of monads? You can assume that I know basic math and basic Haskell syntax. So, for example, "a -> b" is much more clear than "a function that takes input of one type and has an output of a different type".

Any help would be appreciated.

Daniel.
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners