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` ()
As I mentioned on the PR, this often isn't reasonable at all, since there could be fields not covered by the Foldable instance, such as any field that just has a fixed type like String.
It's possible to define a reasonable
NFData
instance for anyFoldable
type. We can offer a suitablernf
to help.