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

Kristopher Micinski krismicinski at gmail.com
Sun Oct 14 20:29:57 CEST 2012


On Sun, Oct 14, 2012 at 1:37 PM, Bartosz Milewski
<bartosz at fpcomplete.com> wrote:
> I'm afraid this kind of 5-minute talk makes sense only if you already know a
> lot about monads or are a computer scientist; not if you're a programmer who
> wants to learn a new language. For instance, this statement starts making
> sense only if you've seen a lot of examples of monads (maybe even read Moggi
> and Wadler) and want to understand the big picture.
>

fwiw I never intended it to be a discussion to people who want to
learn Haskell, my target audience is people who know Haskell basics,
some amount of computer science and math background (typical of ML
converts, for example).

> "... when Haskell programmers want to perform a side effect, they explicitly
> construct a description of the side effecting computation as a value."
>

I really disagree that reading Moggi's paper is a prerequisite to
understanding that statement, I would have understood that (although
without example) long before having read Moggi's paper, and I still
don't understand all of it!

> And even then, what does it mean to "construct a description of the side
> effecting computation as a value" for the Maybe monad? An IO action or a
> State Monad action indeed are values that describe computations, but what
> computation does (Just 1) describe? It's the simple monads that are tricky
> to explain (I've seen a discussion to that effect in this forum and I
> wholeheartedly agree).
>

Agreed, I think the problem here is using Maybe as an example.  The
problem is that monads (as all things in category theory) are these
very general things, to explain them in their full generality is
fundamentally at odds with most peoples' (certainly *my*)
understanding of learning individual examples and generalizing.  While
monads are typically used to structure computation in this way
(building a description of a side effect as a value which is elided in
the bind) they are in reality simply just some monoids in the right
category, but the Maybe description doesn't jibe as well with the
previous explanation, which motivates the need for monads more.  (The
fact you can do this with Maybe is certainly helpful, but people don't
see having to write chains of destructors as as large a barrier to
using Haskell as not being able to use IO, for example..)

kris



More information about the Haskell-Cafe mailing list