[Haskell-cafe] Haskell & monads for newbies

Claus Reinke claus.reinke at talk21.com
Sat Jul 14 18:01:10 EDT 2007


> Yeah, the laws confused me for a while as well.  Hint to guys writing
> Haskell documentation, we're not all doing CS phD you know ;-)  We 
> just want to get things done ;-)

teachers and tutorials making a fuss about some concept is the 
surest way to guarantee that learners will find that concept difficult
(holds for Monads, functional i/o, Monad laws, Turing machines,
higher order functions, and many other things [*]).

the Monad type class tells you the interface (what operations
you've got, and their types), the Monad laws tell you what all
types implementing that interface should have in common. it
is all just about getting things done!-)

the monadic interface gives you two operations, one to throw
things into a monad thing, and one to chain two monad things
together. the monad laws tell you two useful facts about monad
things thrown together in that way: whatever it is the monad
does, anything just thrown into it will take no part in that action,
and whichever way you use that chaining operation, the 
structure of chaining is irrelevant, only the ordering of chained
monad things matters.

hth?-)
claus

[*] digging out the original paper can often be surprisingly
    enlightening, in the algol way of the original being an
    improvement on all its successors.

[**] "thing" is a technical term that would take too long to
    explain, closely related to those "apples" mentioned in
    another thread;-)



More information about the Haskell-Cafe mailing list