[Haskell-cafe] Function Precedence

Jeremy Apthorp nornagon at gmail.com
Tue Apr 1 06:50:57 EDT 2008


On 01/04/2008, PR Stanley <prstanley at ntlworld.com> wrote:
> Hi
>  If
>  f x = x
>  and
>  g y = y
>  then
>  f g x
>  returns an error because f takes only one argument. Why can't we have
>  function application implemented outwardly (inside-out). So
>  f g x would be applied with
>  gx first followed by its return value passed to f instead of putting
>  g x in brackets.

Think about this:

map (+1) [1..10]

What should it do?

How about:

f 1 2 3

Should that be f (1 (2 3)), or ((f 1) 2) 3?

Jeremy


More information about the Haskell-Cafe mailing list