[Haskell-cafe] sections of noncommutative operators

Michael Shulman viritrilbia at gmail.com
Sat Sep 9 04:05:07 EDT 2006


A propos of sections of subtraction, and thence to sections of other
noncommutative operators, as a Haskell newbie I was surprised to
discover (the hard way!) that

(< 0)

and

((<) 0)

mean different things.  I had typed (< 0) when I meant to type ((<)
0).  No compiler errors, of course, and I had a devil of a time
finding that bug.  My initial reaction was that (< 0) should be an
error and you should have to write ((>) 0); now I realize that the
section notation is more fundamental, since (<) itself is actually a
"double section".  And of course I should have written (> 0) anyway;
it's probably my lisp background that tripped me up.  But is there any
way this could be made less confusing?  Do any of the online tutorials
warn against this sort of mistake, and I just missed it?

Mike


More information about the Haskell-Cafe mailing list