On Sun, Aug 12, 2007 at 12:56:31PM +1000, Alexis Hazell wrote:
> On Sunday 12 August 2007 05:24, Stefan O'Rear wrote:
> 
> > Currying makes it MUCH harder to implement varargs functions. 
> 
> That's interesting - why is that the case?

varsum 2 3   -- varsum receives 2, and returns a function, which when
             -- passed 3, returns 5
varsum 2 3 4 -- varsum receives 2, and returns a function, which when
             -- passed 3, returns a function that when passed 4 returns
             -- 9.

Because of this, the number of arguments must somehow be passed
out-of-band; but then the type of the whole function (usually) must
depend on the control parameter, requiring dependent types.

Stefan

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to