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

Fold.Nonempty.Examples.Boring

Description

Folds of other types trivially lifted into NonemptyFold

Synopsis

Endpoints

first :: NonemptyFold a a Source #

The first input

Monoid

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

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

Length

length :: NonemptyFold a Natural Source #

The number of inputs

Boolean

and :: NonemptyFold Bool Bool Source #

True if all inputs are True

or :: NonemptyFold Bool Bool Source #

True if any input is True

all :: (a -> Bool) -> NonemptyFold a Bool Source #

True if all inputs satisfy the predicate

any :: (a -> Bool) -> NonemptyFold a Bool Source #

True if any input satisfies the predicate

Numeric

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

Adds the inputs

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

Multiplies the inputs

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

Numerically stable arithmetic mean of the inputs

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

Numerically stable (population) variance over the inputs

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

Numerically stable (population) standard deviation over the inputs

Search

element :: Eq a => a -> NonemptyFold a Bool Source #

True if any input is equal to the given value

notElement :: Eq a => a -> NonemptyFold a Bool Source #

False if any input is equal to the given value

find :: (a -> Bool) -> NonemptyFold a (Maybe a) Source #

The first input that satisfies the predicate, if any

lookup :: Eq a => a -> NonemptyFold (a, b) (Maybe b) Source #

The b from the first tuple where a equals the given value, if any

Index

index :: Natural -> NonemptyFold a (Maybe a) Source #

The nth input, where n=0 is the first input, if the index is in bounds

findIndex :: (a -> Bool) -> NonemptyFold a (Maybe Natural) Source #

The index of the first input that satisfies the predicate, if any

elementIndex :: Eq a => a -> NonemptyFold a (Maybe Natural) Source #

The index of the first input that matches the given value, if any

List

list :: NonemptyFold a [a] Source #

All the inputs

reverseList :: NonemptyFold a [a] Source #

All the inputs in reverse order