[Haskell-cafe] Currying: The Rationale

Derek Elkins derek.a.elkins at gmail.com
Wed May 23 19:27:06 EDT 2007


Chad Scherrer wrote:
> On 5/23/07, Philippa Cowderoy <flippa at flippac.org> wrote:
>> On Wed, 23 May 2007, Chad Scherrer wrote:
>>
>> > Is (^2) really considered currying? As I understand it, this is
>> > syntactic sugar for a "section", and might confuse the issue a bit,
>> > since it's distinct from ((^) 2).
>>
>> Sure, but it's (flip (^)) 2.
> 
> Well, ok, but you've changed the definition. If it were enough for it
> to be equivalent to a curried version, we could as well write
> 
> sq x = times (x,x) where times (x,y) = x * y
> 
> and argue that this is partial application of a curried function
> because it's equivalent to the curried version you gave. But I guess
> I'm being a bit pedantic here, and I suspect your definition is
> exactly how (^2) is desugared.

Philippa's version is still an instance of partial application; no one said that 
  the function must be a variable, an arbitrary expression is fine.  2 is being 
partially applied to flip (^) so defining sq makes no sense.  Also there are no 
curried functions and no partial applications anywhere in your code.


More information about the Haskell-Cafe mailing list