Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Folds of other types trivially lifted into ShortcutNonempty
Synopsis
- element :: Eq a => a -> ShortcutNonemptyFold a Bool
- notElement :: Eq a => a -> ShortcutNonemptyFold a Bool
- find :: (a -> Bool) -> ShortcutNonemptyFold a (Maybe a)
- lookup :: Eq a => a -> ShortcutNonemptyFold (a, b) (Maybe b)
- sum :: Num a => ShortcutNonemptyFold a a
- product :: Num a => ShortcutNonemptyFold a a
- mean :: Fractional a => ShortcutNonemptyFold a a
- variance :: Fractional a => ShortcutNonemptyFold a a
- standardDeviation :: Floating a => ShortcutNonemptyFold a a
- index :: Natural -> ShortcutNonemptyFold a (Maybe a)
- findIndex :: (a -> Bool) -> ShortcutNonemptyFold a (Maybe Natural)
- elementIndex :: Eq a => a -> ShortcutNonemptyFold a (Maybe Natural)
- length :: ShortcutNonemptyFold a Natural
- and :: ShortcutNonemptyFold Bool Bool
- or :: ShortcutNonemptyFold Bool Bool
- all :: (a -> Bool) -> ShortcutNonemptyFold a Bool
- any :: (a -> Bool) -> ShortcutNonemptyFold a Bool
- maximum :: Ord a => ShortcutNonemptyFold a a
- minimum :: Ord a => ShortcutNonemptyFold a a
- maximumBy :: (a -> a -> Ordering) -> ShortcutNonemptyFold a a
- minimumBy :: (a -> a -> Ordering) -> ShortcutNonemptyFold a a
- last :: ShortcutNonemptyFold a a
- magma :: (a -> a -> a) -> ShortcutNonemptyFold a a
- semigroup :: Semigroup a => ShortcutNonemptyFold a a
- monoid :: Monoid a => ShortcutNonemptyFold a a
- list :: ShortcutNonemptyFold a [a]
- reverseList :: ShortcutNonemptyFold a [a]
Search
element :: Eq a => a -> ShortcutNonemptyFold a Bool Source #
True
if any input is equal to the given value (tenacious)
notElement :: Eq a => a -> ShortcutNonemptyFold a Bool Source #
False
if any input is equal to the given value (tenacious)
find :: (a -> Bool) -> ShortcutNonemptyFold a (Maybe a) Source #
The first input that satisfies the predicate, if any (tenacious)
lookup :: Eq a => a -> ShortcutNonemptyFold (a, b) (Maybe b) Source #
The b
from the first tuple where a
equals the given value,
if any (tenacious)
Arithmetic folds
sum :: Num a => ShortcutNonemptyFold a a Source #
Adds the inputs (ambivalent)
product :: Num a => ShortcutNonemptyFold a a Source #
Multiplies the inputs (ambivalent)
mean :: Fractional a => ShortcutNonemptyFold a a Source #
Numerically stable arithmetic mean of the inputs (ambivalent)
variance :: Fractional a => ShortcutNonemptyFold a a Source #
Numerically stable (population) variance over the inputs (ambivalent)
standardDeviation :: Floating a => ShortcutNonemptyFold a a Source #
Numerically stable (population) standard deviation over the inputs (ambivalent)
Working with indices
index :: Natural -> ShortcutNonemptyFold a (Maybe a) Source #
The nth input, where n=0 is the first input, if the index is in bounds (tenacious)
findIndex :: (a -> Bool) -> ShortcutNonemptyFold a (Maybe Natural) Source #
The index of the first input that satisfies the predicate, if any (tenacious)
elementIndex :: Eq a => a -> ShortcutNonemptyFold a (Maybe Natural) Source #
The index of the first input that matches the given value, if any (tenacious)
Counting inputs
length :: ShortcutNonemptyFold a Natural Source #
The number of inputs (ambivalent)
Boolean folds
all :: (a -> Bool) -> ShortcutNonemptyFold a Bool Source #
True
if all inputs satisfy the predicate (tenacious)
any :: (a -> Bool) -> ShortcutNonemptyFold a Bool Source #
True
if any input satisfies the predicate (tenacious)
Min/max
maximum :: Ord a => ShortcutNonemptyFold a a Source #
The greatest input (ambivalent)
minimum :: Ord a => ShortcutNonemptyFold a a Source #
The least input (ambivalent)
maximumBy :: (a -> a -> Ordering) -> ShortcutNonemptyFold a a Source #
The greatest input with respect to the given comparison function (ambivalent)
minimumBy :: (a -> a -> Ordering) -> ShortcutNonemptyFold a a Source #
The least input with respect to the given comparison function (ambivalent)
First/last
last :: ShortcutNonemptyFold a a Source #
The last input (ambivalent)
General folds
magma :: (a -> a -> a) -> ShortcutNonemptyFold a a Source #
Start with the first input, append each new input on the right with the given function (ambivalent)
semigroup :: Semigroup a => ShortcutNonemptyFold a a Source #
Append each new input on the right with <>
(ambivalent)
monoid :: Monoid a => ShortcutNonemptyFold a a Source #
Start with mempty
, append each input on the right
with <>
(ambivalent)
List folds
list :: ShortcutNonemptyFold a [a] Source #
All the inputs (ambivalent)
reverseList :: ShortcutNonemptyFold a [a] Source #
All the inputs in reverse order (ambivalent)