[Haskell-cafe] Type error with simple list function

Alfonso Acosta alfonso.acosta at gmail.com
Thu Nov 8 09:33:50 EST 2007

Hola Fernando,

On Nov 8, 2007 1:52 PM, Bayley, Alistair
<Alistair_Bayley at invescoperpetual.co.uk> wrote:
> First, you've given a type sig which
> suggests that f takes two arguments (both lists of type [a]) and returns
> a list of type [a]. However, there is only one argument to f. A type sig
> that better matches your function definition might be f :: [a] -> [a]

Alistair is surely aware of this, but, as a side note, and even if in
this concrete case f might need to make the two arguments explicit,
currying permits avoid specifing all the arguments (and it's used all
the time by Haskell programmers)

This two definitions are equivalent

add1 :: Num a => [a] -> [a]
add1 = map (+1)

add1 :: Num a => [a] -> [a]
add1 xs = map (+1) xs

More information about the Haskell-Cafe mailing list