Re: [Haskell] factoring `if'

2004-10-11 Thread Colin Runciman
Serge, How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? (1) (\ x - (if p x then foo (g x) else foo (h x)) where p ... g ... h ... foo ... ) (2) (\ x - foo ((if p x then g x else h x) where

Re: [Haskell] factoring `if'

2004-10-11 Thread Jeremy Gibbons
On Mon, 11 Oct 2004, Serge D. Mechveliani wrote: How do you think, is the program (1) equivalent to (2) in the meaning of Haskell-98 ? Not at all. If foo is non-strict and p partial, (2) may yield a result where (1) would not. You identify the possibility yourself: (2) is lazier. (1) (\ x