[Haskell-cafe] Desugaring of infix operators is (always?) the wrong way round

Jonathan Cast jcast at ou.edu
Tue Sep 25 14:50:56 EDT 2007


On Tue, 2007-09-25 at 19:18 +0100, Brian Hulley wrote:
> Brian Hulley wrote:
> > I'm wondering if anyone can shed light on the reason why
> >
> >    x # y
> >
> > gets desugared to
> >
> >   (#) x y
> >
> > and not
> >
> >   (#) y x
> >
> 
> > Can anyone think of an example where the current desugaring of infix 
> > arguments gives the correct order when the function is used in a 
> > postfix application? (apart from commutative functions of course!)
> >
> Sorry I meant to write "*prefix* application"

Of course, this is all a consequence of the well-known failure of
natural language: verbs come before their objects.  It is thus natural
to write f(x), when in fact it is the object that should come first, not
the function.  Switching to a (natural) language where (finite) verbs
come at the end of sentences, where they belong, should fix this issue
in time.  Doing the same in a functional language would be ideal as
well, but might limit its use among those who speak inferior natural
languages.

jcc




More information about the Haskell-Cafe mailing list