partial application

Alastair David Reid
18 Mar 2002 13:34:14 +0000

> Is there a reason why partial application cannot be
> applied in arbitrary order? Was it a technical difficulty in the
> design of Haskell? Or is it just following beta reduction
> rigorously?

Haskell doesn't dictate any particular evaluation order.  If you look
at the name of the Haskell report, it calls Haskell a "non-strict"
language not a "lazy" language.

Implementations of Haskell lean towards implementing a particular
evaluation order (usually a minor variant on lazy evaluation) because
it has been thoroughly studied, it has some properties, and because it
leads to more consistent behaviour.  Lazy evaluation tends to be the
behaviour of the underlying abstract machine used by the compiler.

But implementations can and do go for a different evaluation order in
order to get better performance or to exploit parallel hardware.
Three particular optimizations to look for are full-laziness,
deforestation, and strictness analysis.

Alastair Reid        Reid Consulting (UK) Ltd