DISCLAIMER: I've never written a `large' application in Haskell and
perhaps don't appreciate the problems. I _do_ use Haskell for personal
progams
because its so much quicker and easier to get right. (Work is mandated in
C++)

I like Simon Peyton Jones basic extension of guards. However, I'm a bit
more sceptical about Heribut Schutz's nested guards, and/or turning it
into a general monad expression. One of the annoyances of using C/C++ is
the need to decode syntactic noise and programmer optimisations like +=.
Haskell
is nice because (excepting deeply nested cases and lets) it's generally
easy to
see what is in scope where and what pieces are independent in function
definitions. Nesting scopes seems to me to have tipped over into the
region where I'd have to start decoding again. Similarly, monad syntax
isn't something I can read without breaking it down into minimal
components and building it up again.

Since the new guards do seem  to be powerful notation which should be
encouraged by all users of the language, not just those with sufficient
experience, I'd prefer to see a rule that operationally common prefixes
are squeezed out (in some order which would maximise efficiency without
changing semantics; what that would be isn't obvious to me). We would then
have a situation analogous to pattern matching on multiple parameters,
where the order affects the strictness in the arguments and needs to be
taken into account (and even be exploited) in some functions, but for the
majority of functions is not significant.

Does anyone directly concerned with teaching FP for the first time have
any views on the above?

David Tweed



Reply via email to