-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Milestone
Description
Both Data.Vector.Primitive
and Data.Vector.Unboxed
do not have a foldMap function. There is no particularly compelling technical reason this doesn't exist. It has the following implementation for example:
foldMap :: forall m a . (Unbox a, Monoid m) => (a -> m) -> Vector a -> m
{-# INLINE foldMap #-}
foldMap f = foldr (mappend . f) mempty
foldMap :: forall m a. (Prim a, Monoid m) => (a -> m) -> Vector a -> m
{-# INLINE foldMap #-}
foldMap f = foldr (mappend . f) mempty
Note that this is the default implementation in the Foldable typeclass. The main downside to adding this definition is that is adds a potential namespace clash but both of these modules are already drowning in such namespace clashes and so I don't see this as a serious objection.
recursion-ninja, emilypi and sheaf
Metadata
Metadata
Assignees
Labels
No labels