Oleg Lobachev wrote:
#ifdef USE_REPORT_PRELUDE and = foldr (&&) True or = foldr (||) False #else and [] = True and (x:xs) = x && and xs or [] = False or (x:xs) = x || or xs{-# RULES"and/build" forall (g::forall b.(Bool->b->b)->b->b) .and (build g) = g (&&) True"or/build" forall (g::forall b.(Bool->b->b)->b->b) .or (build g) = g (||) False #-} #endifIs there any reason for that besides some clever optimizations?
The thing I find puzzling is that the foldr is inlined. The (regular) clever optimizations for build/foldr seem like they should already handle this without the need for the extra rules. I wonder how much is gained by specializing to (&&)/True instead of relying on the regular deforestation?
-- Live well, ~wren _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
