Offer Foldable helper
Open
- Dominant language
- Haskell
- Stars
- 45
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
It's possible to define a reasonable `NFData` instance for any `Foldable` type. We can offer a suitable `rnf` to help.
``` haskell
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` ()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.