
27 Nov
2008
27 Nov
'08
2:08 p.m.
Hi all, Here's a ghci session, using bytestring-0.9.1.4 and ghc-6.10: Prelude> :m Data.ByteString.Lazy.Char8 Prelude Data.ByteString.Lazy.Char8> :m -Prelude Data.ByteString.Lazy.Char8> foldr (:) [] (concat (Prelude.repeat "a")) Loading package bytestring-0.9.1.4 ... linking ... done. "*** Exception: stack overflow By contrast, using Prelude's foldr and concat: Prelude> foldr (:) [] (concat (repeat "a")) :: String <prints out an infinite list> Each bytestring chunk only contains one letter, so I would expect the foldr of bytestring to behave just like that of the Prelude. Is this a bug? A feature? From looking at the bytestring source code I don't see why the code behaves this way. Many thanks, Mathieu