[Haskell-cafe] Newbie question: the need for parentheses

Neil Mitchell ndmitchell at gmail.com
Tue Jan 8 16:43:36 EST 2008


Hi

> suma [] = 0
> suma (h:t) = h + suma t
>
> suma [] = 0
> suma h:t = h + suma t

Infix operators bind less tightly than function application, so the
compiler sees:

(suma h) : t = h + (suma t)

Hence the compiler gets confused.

Thanks

Neil


More information about the Haskell-Cafe mailing list