
20 Jun
2011
20 Jun
'11
8:44 p.m.
On Mon, Jun 20, 2011 at 10:11 PM, Duncan Coutts
Mm, the '1' variants are obvious. The fold and foldMap are more interesting. I'd have to think harder about what their default definition would be, or what specialised implementations might look like (e.g. tree folds starting from the leaves and working towards the root). Are there any obvious use cases for strict monoid folds?
How about parallel folds? Here's something I'd like to support for HashMap: parFold :: Monoid m => (v -> m) -> HashMap k v -> m sumValues = parFold Sum Another really nice property of monoid folds is that they get call-site specialized automatically by GHC. Johan