[Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.

Ketil Malde ketil at malde.org
Thu Oct 1 03:36:03 EDT 2009


namekuseijin <namekuseijin at gmail.com> writes:

> Point is:  >>= . $ : ! `` and meaningful whitespace are all nice
> shortcuts, but also hairy confusing...

As somebody pointed out, these are rather idiomatic, and only confusing
to beginners.  (I'm not sure what you refer to with whitespace, some
think layout makes code difficult to write, but I don't think it hurts
legibility?  If you refer to extension that makes 'x?y' and 'x ? y' mean
different things, then I agree: that way lies madness.)

I agree it's usually better to use real names, but one problem with many
operators (and Haskell functions in general) is their extreme
generality.  For instance, the >>= cominator is usually pronounced
'bind'.  Does this really help?

         exp1 >>= exp2
     vs  exp1 `bind` exp2
or even  bind exp1 exp2

In some cases where names are used, it just increases confusion,
e.g. the Monoid function 'mappend' is nice for concatenating two lists,
but a rather odd name for mulitplying two integers.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list