[Haskell] Re: factoring `if'

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon Oct 11 07:08:21 EDT 2004


Serge D. Mechveliani wrote:
> [...]

> People note that in my example of
>
> > > (1)   (\ x -> (if p x then  foo (g x)  else  foo (h x)) ...)
> > >
> > > (2)   (\ x -> foo  ((if p x then  g x  else  h x)) )
>
> p x  may be _|_, and this makes (1) not equivalent to (2).

Yes.  I think, the point is that laziness does not only have something to do
with execution behavior but also with the meaning of expressions as soon as
_|_ values are considered.

> Serge Mechveliani

Wolfgang



More information about the Haskell mailing list