> > Indeed.  But if you get this far, understanding (>>=) quite trivial
> > (assuming you don't have problems with higher-order functions).
> Yes, it would be quite trivial.  But why bother?  You only need (>>=)
> if you want to declare your own instance of Monad, which probably doesn't
> need to be in an introductory course.

I think I would feel quite unsatisfied if I didn't know that 'do' is
not some strange feature which seems to be unrelated to the rest, but
only some syntactic sugar for very normal higher order combinators.

And even if propably none ever needs it, I feel much happier to know
that 'zipWith (>>=)' is there and doesn't have to be written in
do-syntax. This is what reassures me that 'IO a' is an abstract, but
otherwise normal data type.

It may be useful, in the beginning of a course, to tell the students
how to do some simple IO using 'do' in a recipe like manner. (But if
they are using an interpreter and don't have to write a main function,
you can as well leave this out.) But in order to explain monads even
to someone who wouldn't define his own, I'd surely not conceal (>>=).


Alll the best,
Christian Sievers


Reply via email to