You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There should be something to fold an iterator of monoids down to a single value, or to create the Monoids first and then fold them. fold_map is one of my favorite things in haskell.
Vague ideas: (not thinking too hard about references and whatnot, since I'd rather see #57 before this)
or maybe we can do better, with the understanding that fold_map is really only useful for newtypes (so it might as well get unwrapped at the end; this will require some sort of Newtype or Iso(-morphism) trait)
// where Product<i32> implements some trait that provides// conversions for i32 <-> Product<i32>vec![1, 2].iter().combine_like(Product);// -> i32 (for Monoids)vec![1, 2].iter().combine_option_like(Product);// -> Option<i32> (for Semigroups)vec![1, 2].iter().combine_onto_like(1,Product);// -> i32 (for Semigroups)
The text was updated successfully, but these errors were encountered:
There should be something to fold an iterator of monoids down to a single value, or to create the Monoids first and then fold them.
fold_map
is one of my favorite things in haskell.Vague ideas: (not thinking too hard about references and whatnot, since I'd rather see #57 before this)
or maybe we can do better, with the understanding that
fold_map
is really only useful for newtypes (so it might as well get unwrapped at the end; this will require some sort ofNewtype
orIso
(-morphism) trait)The text was updated successfully, but these errors were encountered: