-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
It's possible to define a reasonable NFData instance for any Foldable type. We can offer a suitable rnf to help.
data Unit = Unit
instance Monoid Unit where
mempty = Unit
Unit `mappend` Unit = Unit -- strict in both arguments, unlike ()
rnfFoldable :: (Foldable f, NFData a) => f a -> ()
rnfFoldable xs = foldMap (\x -> rnf x `seq` Unit) xs `seq` ()andreasabel
Metadata
Metadata
Assignees
Labels
No labels