Here's a clearer description:<div>class Monad m where</div><div> return :: a -> m a</div><div> (>>=) :: m a -> (a -> m b) -> m b</div><div><br></div><div>Instances of Monad must satisfy the following laws:</div>
<div> return a >>= k == k a</div><div> m >>= return == m</div><div> m >>= (k >>= h) == (m >>= k) >>= h</div><div><br></div><div>Much more clear and concise, don't you think?<br><br>
<div class="gmail_quote">On Wed, Apr 22, 2009 at 6:21 AM, Daniel Carrera <span dir="ltr"><<a href="mailto:daniel.carrera@theingots.org">daniel.carrera@theingots.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I hate monads.<br>
<br>
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:<br>
<br>
"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".<br>
<br>
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.<br>
<br>
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....<br>
<br>
<br>
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".<br>
<br>
Any help would be appreciated.<br>
<br>
Daniel.<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>