Skip to content

List-monomorphic `foldr'`

vdukhovni requested to merge trac-vdukhovni/ghc:mono-foldr-prime into master

Per CLC discussion, add list-monomorphic foldr'. The commit message is:

While a strict (i.e. constant space) right-fold on lists is not possible, the default foldr' is optimised for structures like Seq, that support efficient access to the right-most elements. The original default implementation seems to have a better constant factor for lists, so we add a monomorphic implementation in GHC.List.

Should this be re-exported from Data.List? That would be a user-visible change if both Data.Foldable and Data.List are imported unqualified...

Merge request reports