We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3228a09 commit ad211f6Copy full SHA for ad211f6
src/FSharpPlus/Operators.fs
@@ -1607,6 +1607,13 @@ module Operators =
1607
/// <category index="23">Additional Functions</category>
1608
let inline sum (x: '``Foldable<'Monoid>``) : 'Monoid = fold (++) (getZero () : 'Monoid) x
1609
1610
+ /// <summary>
1611
+ /// Folds the sum of all monoid elements in the Foldable resulting of applying the projection.
1612
+ /// </summary>
1613
+ /// <category index="23">Additional Functions</category>
1614
+ let inline sumBy ([<InlineIfLambda>] projection: 'T -> 'Monoid) (x: '``FoldableFunctor<'T>``) : 'Monoid =
1615
+ fold (++) (getZero () : 'Monoid) (map projection x)
1616
+
1617
/// <summary>
1618
/// Converts using the implicit operator.
1619
/// </summary>
0 commit comments