[Haskell-cafe] Re: let vs. where
Jules Bean
jules at jellybean.co.uk
Fri Nov 16 17:35:24 EST 2007
John Lato wrote:
> This actually clears up something that's been bothering me for some
> time. I've never really like syntax of types for functions with
> multiple arguments. Using the same token, "->", to separate both
> arguments and the result seems very poor, because when reading a type
> you don't know if the value after that token is another argument or
> the final result without going further ahead. However, knowing that a
> function takes exactly one argument makes the syntax seem much more
> expressive for me.
Right. This is because -> doesn't separate arguments from each other. It
separates the one and only argument from the one and only result:
a -> b -> c -> d
Has one argument of type 'a' and returns one result,
of type 'b -> c -> d'
The syntax is therefore consistent and uniform if a bit surprising at
first glance.
It turns out that we can usefully think of this as having three
arguments and one result, but it doesn't really. It has one argument and
one result. (It's just the result itself takes arguments!)
Jules
More information about the Haskell-Cafe
mailing list