On 26 Sep 2007, at 8:32 am, Brian Hulley wrote:
Aha! but this is using section syntax which is yet another
complication. Hypothesis: section syntax would not be needed if the
desugaring order was reversed.
Binary operators have two arguments. That's why sections are needed.
This is one of the reasons why the combination of
- sections
- ordinary names as `operators`
is so nice. Given a function f :: X -> Y -> Z.
Currying means that we have (f x) :: Y -> Z.
With sections, we also have (`f`y) :: X -> Z.
It doesn't matter *which* argument you put first,
people will sometimes need to partially apply to one of them,
and sometimes to the other.
My old ML library includes
fun ap1 f x = fn y => f (x,y) (* == (x `f`) *)
fun ap2 f y = fn x => f (x,y) (* == (`f` y) *)
Both are needed because the SML convention for operators passes a tuple.
The point is that BOTH are needed.
I am a bear of very little brain, and I would find it VERY confusing
if the order of arguments in an operator application did not match
the order of arguments in a function call. I can live with
x @ y = (op @)(x, y) (* SML *)
x @ y = (@) x y -- Haskell
but making the orders different would guarantee that I would *always*
be in a muddle about which argument was which. Living with
inconvenient argument orders is vastly easier than with inconsistent
ones.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe