[Haskell-cafe] lazy evaluation is not complete

Max Rabkin max.rabkin at gmail.com
Tue Feb 10 01:57:58 EST 2009


On Mon, Feb 9, 2009 at 10:50 PM, Iavor Diatchki
<iavor.diatchki at gmail.com> wrote:
>  I 0 * _       = I 0
>  I x * I y     = I (x * y)

Note that (*) is now non-commutative (w.r.t. _|_). Of course, that's
what we need here, but it means that the "obviously correct"
transformation of

> foo x = if x == 0 then 0 else foo (x - 1) * foo (x + 1)

into

foo' x = if x == 0 then 0 else foo' (x + 1) * foo' (x - 1)

is *not* in fact correct.

--Max


More information about the Haskell-Cafe mailing list