[Haskell-cafe] Tutorial: Haskell for the Evil Genius

Kristopher Micinski krismicinski at gmail.com
Sat Sep 15 02:56:36 CEST 2012

On Fri, Sep 14, 2012 at 8:23 PM, Andrew Pennebaker
<andrew.pennebaker at gmail.com> wrote:
> [snip..]
> Does anyone know of a brief introductory Haskell tutorial that engages
> monads? LYAH covers monads, but it does so after a few chapters of simpler,
> pure function Haskell coding. I know of some brief tutorials for monads that
> explain them in a variety of creative ways, but they all assume the reader
> is at least somewhat familiar with Haskell.

My opinion: you are walking down the potentially disastrous road of
trying to introduce monads in as small a tutorial as yours.  If the
person reading the tutorial is *indeed* an evil genius, I'd at least
start by showing an example of a monad that wasn't a disingenuous
presentation of their full capabilities (I'm taking a long cold stare
at  the people who write tutorials that say "hey, Maybe is a monad,
and Maybe is simple, so monads a pretty simple too!"), like the Cont
monad.  But, you say, "hell, Cont has quite a complex set of things
going on!"  And I say, yes, it's sufficiently complicated to force
people to work out the underlying details.

(As a side note, I've had an itching feeling to introduce monads to
students via having them write an interpreter and presenting it by
proxy of state based semantics in something of the spirit of Imp.)

Monads are a complex subject, not overly complex, I would say "they
let you chain things together and hide behavior under the rug," but
even this isn't helpful to someone to hasn't seen them before.  So my
argument is that if you introduce monads, you do so with a great
example that demonstrates a nontrivial monad (State or Cont, *not*
Maybe or IO).  This is a case where forcing people to work out the
math is imperative (hehe, get it, it's a pun..), programmers' natural
tendency when they see IO examples is to say "oh hey, I'll just copy
that pattern, and that's how you do IO," where in reality this doesn't
showcase everything monads really do.

If you want to *link* to some good tutorials, I think that reading the
"All about monads" tutorial is a great way to learn Haskell, period.

Everyone in the Haskell cafe probably has a secret dream to give the
best "five minute monad talk."  Challenge: get someone to have a
competition at one of the conferences where students all give their
best "five minute monad talk" and try to find the most comprehensible

Perhaps that was a bit of a rant, apologies if so,


More information about the Haskell-Cafe mailing list