[Haskell-cafe] scanr producer?

Louis Wasserman wasserman.louis at gmail.com
Tue Dec 9 17:29:21 EST 2008


Is there a change in strictness with the following transformation?  It seems
like scanr should be a good consumer and a good producer, intuitively.

scanrFB :: (a -> b -> b) -> b -> [a] -> (b -> c -> c) -> c -> c
scanrFB f x ls c n = snd (foldr (\ x (b, bs) -> let b' = f x b in (b', b'
`c` bs)) (x, n) ls)

{-# RULES
"scanr" [~1] forall f x l . scanr f x l = build (scanrFB f x l);
-# RULES}
-- 
Louis Wasserman
wasserman.louis at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081209/e70880b0/attachment.htm


More information about the Haskell-Cafe mailing list