gambler-0.1.0.0: Composable, streaming, and efficient left folds
Safe HaskellSafe-Inferred
LanguageGHC2021

Fold.Shortcut.Examples.Boring

Description

Folds of other types trivially lifted into Shortcut

Synopsis

Arithmetic folds

sum :: Num a => ShortcutFold a a Source #

Adds the inputs (ambivalent)

product :: Num a => ShortcutFold a a Source #

Multiplies the inputs (ambivalent)

mean :: Fractional a => ShortcutFold a a Source #

Numerically stable arithmetic mean of the inputs (ambivalent)

variance :: Fractional a => ShortcutFold a a Source #

Numerically stable (population) variance over the inputs (ambivalent)

standardDeviation :: Floating a => ShortcutFold a a Source #

Numerically stable (population) standard deviation over the inputs (ambivalent)

Counting inputs

length :: ShortcutFold a Natural Source #

The number of inputs (ambivalent)

Min/max

maximum :: Ord a => ShortcutFold a (Maybe a) Source #

The greatest input (ambivalent)

minimum :: Ord a => ShortcutFold a (Maybe a) Source #

The least input (ambivalent)

maximumBy :: (a -> a -> Ordering) -> ShortcutFold a (Maybe a) Source #

The greatest input with respect to the given comparison function (ambivalent)

minimumBy :: (a -> a -> Ordering) -> ShortcutFold a (Maybe a) Source #

The least input with respect to the given comparison function (ambivalent)

First/last

first :: ShortcutFold a (Maybe a) Source #

The first input (tenacious)

last :: ShortcutFold a (Maybe a) Source #

The last input (ambivalent)

General folds

magma :: (a -> a -> a) -> ShortcutFold a (Maybe a) Source #

Start with the first input, append each new input on the right with the given function (ambivalent)

semigroup :: Semigroup a => ShortcutFold a (Maybe a) Source #

Append each new input on the right with <> (ambivalent)

monoid :: Monoid a => ShortcutFold a a Source #

Start with mempty, append each input on the right with <> (ambivalent)

List folds

list :: ShortcutFold a [a] Source #

All the inputs (ambivalent)

reverseList :: ShortcutFold a [a] Source #

All the inputs in reverse order (ambivalent)