[Haskell-cafe] Re: Tutorial uploaded

Paul Moore p.f.moore at gmail.com
Thu Dec 22 08:57:42 EST 2005

On 12/22/05, John Meacham <john at repetae.net> wrote:
> Just the idea that you can write things like mapM and replicateM is
> enough to blow the mind of many impertive programmers.

Not trying to fan the flames, but one thing I struggle with is
understanding (at a "gut level" - if you explain the theory, I'll
understand, but go away none the wiser in practice...) why I need mapM
as well as map (and all the other -M functions, liftM, foldM, etc...)

mapM and so on really *are* why the IO monad is a great feature of
Haskell. But the mental gearchange needed to appreciate what just
happened is one of the speedbumps on the learning curve. You thought
you were getting along fine, you'd got the point of functional stuff
like map and fold, and you understood IO and it wasn't as scary as
you'd thought. But then along comes mapM, and you're struggling again
- why not just use map? And the explanation doesn't help much, it just
leaves you feeling that you'd missed the point.

As I say, I'm not trying to criticize anyone here, but it seems to be
quite hard to get across to people who have understood and assimilated
this sort of stuff, just how hard it feels to newcomers. We understand
the explanations (we do! really! :-)) but even understanding them, we
are still left with a lack of confidence. It's like being shown a full
set of carpentry tools, having every one explained, but still reaching
for the hammer every time and banging something no matter what we're
trying to do :-)


More information about the Haskell-Cafe mailing list