Quantcast

Implement foldMap on Data.Sequence.Seq?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Implement foldMap on Data.Sequence.Seq?

Sjoerd Visscher-2
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





_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Loading...