Implement foldMap on Data.Sequence.Seq?
Sjoerd Visscher
sjoerd at w3future.com
Sat Nov 5 14:04:31 CET 2011
When experimenting with the code here:
http://stackoverflow.com/questions/7869359/why-is-it-faster-to-sum-a-data-sequence-by-divide-and-conquer-even-with-no-para
it turned out that foldMapDefault from traversable was more than 2x faster than foldl', and more than 6x faster than foldMap.
foldMap is not implemented by Data.Seq, so it defaults to foldr (mappend . f) mempty.
Does anybody have a good explanation for the StackOverflow question, and would it be a good idea to add a foldMap implementation to Seq?
greetings,
Sjoerd Visscher
More information about the Libraries
mailing list