scanl does not participate in list fusion
nomeata came up with a fusable version of a strict
scanl' in a comment on #9345 (closed) that uses the same basic technique as the new
foldl. I think we should use something like the following non-strict version to replace the current
scanl :: (b -> a -> b) -> b -> [a] -> [b] scanl f a bs = build $ \c n -> a `c` foldr (\b g x -> let b' = f x b in (b' `c` g b')) (const n) bs a
While we're at it, we should make sure that
map g . scanl f a and
scanl f a . map g fuse properly.