At first, I thought monads were too complicated for me.
Then after weeks, I slowly grew a kind of fuzzy understanding of monads, at least enough to feel comfortable using a few of them.
I can't rewrite the State monad without re-reading a tutorial, but I know that I would understand it better this time.
But sometimes on haskell-cafe you read a discussion about monads, and as always, the discussion goes into category, set or whatever math theory I don't know about.
After that kind of discussion, comes the feeling that I really only have scratched the surface of what monads are, and that it's really some deep ( and complicated ) subject.
Yet, high level haskellers often tell you that it's not !
Beginners like me, with a strong background in imperative programming languages, and without much mathematical knowledge, need a simple way of learning monads.
Perhaps, taking a few parts of haskell ( Parsec, State, List, Maybe, STM ) and without insiting on the fact it's monads, explain their usefulness, what's the advantage to having programmed them that way. And at that point, don't confuse the beginner with the monadic laws.
The most important, have lots of real-world example cases.
From then on, time to show the beginner that there's a common pattern in those parts, and tell more about monads, introduce the monadic laws.
Talk about monad transformers, but not in too much details yet.
Again, have lots of real-world examples.
Subscribe to:
Post Comments (Atom)
1 comment:
Try out this explanation. It's pretty straightforward from an imperative point of view.
Post a Comment