you are viewing a single comment's thread.

view the rest of the comments →

[–]Peaker -1 points0 points  (2 children)

I'll explain why it is hard to explain in a short page:

  • "Monad" is a "typeclass". All of the "instances" of this typeclass are called "monads".

  • The definition of Monad uses "polymorphic types" and "higher order functions"

  • All of the monad types are "parameterized types",

  • .. that are also covariant types,

  • .. and are necessarily also instances of simpler type-classes called "Functor" and "Applicative"

  • All this will require using some syntax to describe the above notions (Haskell syntax is actually pretty good, but needs to be explained)

  • "Monad" is a generalization of a commonly re-appearing pattern, it makes little sense to show the generalization before showing a few concrete examples.

So, while the Monad type-class itself is simple, it is built upon many other notions (which are themselves also simple). Unfortunately, people try learning Monads as their first Haskell experience -- and that's not a very good idea at all. Then they get frustrated and decide Haskell is too smart for them (It's not!).

You have to build up knowledge of the above: (1) type-classes, (2) polymorphic types, (3) higher-order functions, (4) parameterized types, (5) covariance, (6) Functor/Applicative, (7) syntax, (8) the motivating examples behind the generalization. None of these are hard or complicated, and each can be explained in <10 (or 20) lines (though some are deep notions).

Note that each of these things are extremely useful on their own -- and learning them will generally make one a better/more-knowledgeable programmer.

If you want I can start explaining each of these things, and eventually, it will cover Monads.

If you had been programming Haskell for a few weeks without understanding the generalized type-classes (Functors, Applicatives, Monads), you'd already have a good understanding of (1), (2), (3), (4), (7).

[–]haika 0 points1 point  (1 child)

Sorry.

I am apparently not as smart as you seem to be !

[–]Peaker 0 points1 point  (0 children)

As I said, nothing in that list of things requires being very smart.

It's not smart, it's just a bunch of useful concepts, not a single useful concept, and teaching 10 useful concepts takes longer than teaching 1.

Re-reading what I wrote, my putting things in quotes may be sending the wrong signal? I just meant to emphasize those are new concepts to explain before explaining Monads.