Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides a
Fold1
type that is a "non-empty" analog of the
Fold
type, meaning that it requires at least one input element in order to
produce a result
This module does not provide all of the same utilities as the
Control.Foldl
module. Instead, this module only provides the utilities
which can make use of the non-empty input guarantee (e.g.
head
). For
all other utilities you can convert them from the equivalent
Fold
using
fromFold
.
Synopsis
- data Fold1 a b = Fold1 (a -> Fold a b)
- fold1 :: Foldable1 f => Fold1 a b -> f a -> b
- fromFold :: Fold a b -> Fold1 a b
- toFold :: Fold1 a b -> Fold a ( Maybe b)
- nonEmpty :: Fold1 a ( NonEmpty a)
- sconcat :: Semigroup a => Fold1 a a
- head :: Fold1 a a
- last :: Fold1 a a
- maximum :: Ord a => Fold1 a a
- maximumBy :: (a -> a -> Ordering ) -> Fold1 a a
- minimum :: Ord a => Fold1 a a
- minimumBy :: (a -> a -> Ordering ) -> Fold1 a a
Documentation
Instances
nonEmpty :: Fold1 a ( NonEmpty a) Source #
Fold all values within a non-empty container into a
NonEmpty
list
sconcat :: Semigroup a => Fold1 a a Source #
Fold all values within a non-empty container using (
<>
)