[Haskell-cafe] Precedence (Part 2)

PR Stanley prstanley at ntlworld.com
Thu Apr 3 13:13:40 EDT 2008


Hi folks

 > let f = sum.map (^2).filter even
 > f [1..4]
20

So far so good!

 > sum.map (^2).filter even [1..4]
returns an error.

How is it that the composition above as part of a function equation 
doesn't return any errors while on its own it requires parentheses? I 
can understand the need for the parentheses - the composition 
operator takes two arguments/operand,s each of which is a mapping 
which must correspond to specific domain and range requirements i.e. 
(b->c -> (a->b) -> (a->c)
Why aren't the parentheses required in the function definition?

Cheers,
Paul



More information about the Haskell-Cafe mailing list