[Haskell-cafe] argument counts...
Neil Mayhew
neil_mayhew at users.sourceforge.net
Mon Nov 20 18:16:27 UTC 2017
On 2017-11-20 10:13 AM, Gregory Guthrie wrote:
>
> But since the interpreter already correctly inferred that the first
> clause has two arguments (with only one explicit), why does it then
> ignore this and give an error when the second clause shows two
> explicit arguments? The types are all correct in either case – why
> require explicit arguments?
>
Actually, the first clause doesn't have two arguments. It's a
single-argument function that returns a one-argument function. Strictly
speaking, all multi-argument functions are one-argument functions that
return other functions, but the compiler makes a distinction, perhaps to
help guard against mistakes. So it's a requirement that all clauses of a
function definition have the same number of explicit arguments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20171120/7b6dea76/attachment.html>
More information about the Haskell-Cafe
mailing list