[Haskell-cafe] Re: Currying and Partial Evaluation

Derek Elkins derek.a.elkins at gmail.com
Tue Jan 8 21:01:14 EST 2008


On Wed, 2008-01-09 at 03:37 +0100, Achim Schneider wrote:
> Derek Elkins <derek.a.elkins at gmail.com> wrote:
> 
> > On Wed, 2008-01-09 at 00:51 +0100, Achim Schneider wrote:
> > > Fernando Rodriguez <frr149 at easyjob.net> wrote:
> > > 
> > > > 
> > > > Hi,
> > > > 
> > > > Is currying in Haskell the same thing as Partial Evaluation
> > > > (http://en.wikipedia.org/wiki/Partial_evaluation)? Am I getting
> > > > partial evaluation for free just by using Haskell? 
> > > > 
> > > No, currying is this:
> > 
> > No, it is not.  This is partial application.  See the wiki page Neil
> > referenced.
> > 
> Which works because of the functions being curried...

and therefore partial application can't be currying.  Currying is the
operation of turning (a,b) -> c into a -> b -> c.  Nothing more.

>  of course, the
> usage is to "partly" apply a function, which is not possible, as all
> Haskell functions are, by default, curried, and thus only have one
> parameter, which can either be applied or not.

Indeed.  Partial application is a fuzzy term.  I give a potential
objective definition here:
http://lambda-the-ultimate.org/node/2266#comment-33620

> 
> Partial evaluation, OTOH, goes into the direction of laziness vs.
> eagerness: Iff the compiler sees that a thunk is only dependent on data
> known at compile-time, it may choose to evaluate this thunk already at
> compile-time, if you're lucky and the compiler isn't lazy,

Partial evaluation has little to do with lazy v. eager evaluation.

> main = putStrLn $ show $ 1 + 2
> 
> might end up being
> 
> main = putStrLn "3"
> 
> in the object file.
> 
> 



More information about the Haskell-Cafe mailing list