[Haskell-cafe] do

Dan Piponi dpiponi at gmail.com
Mon Dec 3 17:25:31 EST 2007

On Dec 3, 2007 1:09 PM, Denis Bueno <dbueno at gmail.com> wrote:

> I don't think I can conclude that there are *no* reasons to teach the
> do-notation first.  I just think that it is more instructive to teach
> it later.

It's standard in mathematics teaching, when introducing a mathematical
structure X, to ensure that students have the knowledge to understand
an example of X before they see the definition of X. So students won't
study groups before they've met the integers, they won't study fields
before they've met the rationals, and they won't study topology until
they're familiar with the real line. Not just met them either, usually
they've usually completely internalised the examples before moving
onto the general structure.

The problem with monads is that students have never knowingly met an
example of a monad before. If you teach them do-notation for IO
without monads, and they get completely familiar with it (which (1) I
claim is easy: http://sigfpe.blogspot.com/2007/11/io-monad-for-people-who-simply-dont.html
and (2) is inevitable if they want to see the output of their
programs) then when they come to learning about monads in general
they'll have an example they don't even have to think about. The more
adventurous ones may even discover some of the monad laws for
themselves if they experiment with nested do's like in Tim Newsham's
examples (and think them so obvious they hardly need to be graced with
the name "law").

More information about the Haskell-Cafe mailing list