semifoldable-0.2: Class of non-empty data structures that can be folded to a summary value.

CopyrightEdward Kmett
LicenseBSD-style (see the LICENSE file in the distribution)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Semifoldable

Description

class of non-empty data structures that can be folded to a summary value.

Synopsis

Documentation

class Foldable t => Semifoldable t where Source #

Non-empty data structures that can be folded.

Minimal complete definition

semifoldMap | semifoldrMap

Methods

semifold :: Semigroup m => t m -> m Source #

Combine the elements of a structure using a semigroup.

semifoldMap :: Semigroup m => (a -> m) -> t a -> m Source #

Map each element of the structure to a semigroup, and combine the results.

>>> semifoldMap Sum (1 :| [2, 3, 4])
Sum {getSum = 10}

semifoldMap' :: Semigroup m => (a -> m) -> t a -> m Source #

A variant of semifoldMap that is strict in the accumulator.

>>> semifoldMap' Sum (1 :| [2, 3, 4])
Sum {getSum = 10}

semifoldr :: (a -> a -> a) -> t a -> a Source #

Right-associative fold of a structure.

In the case of lists, semifoldr, when applied to a binary operator, and a list, reduces the list using the binary operator, from right to left:

semifoldr f [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn1 `f` xn )...)

Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, semifoldr can produce a terminating expression from an infinite list.

For a general Semifoldable structure this should be semantically identical to,

semifoldr f = semifoldr f . toNonEmpty

semifoldr' :: (a -> a -> a) -> t a -> a Source #

Right-associative fold of a structure, but with strict application of the operator.

semifoldl :: (a -> a -> a) -> t a -> a Source #

Left-associative fold of a structure.

In the case of lists, semifoldl, when applied to a binary operator, and a list, reduces the list using the binary operator, from left to right:

semifoldl f [x1, x2, ..., xn] == (...((x1 `f` x2) `f`...) `f` xn

Note that to produce the outermost application of the operator the entire input list must be traversed. This means that semifoldl will diverge if given an infinite list.

Also note that if you want an efficient left-fold, you probably want to use semifoldl' instead of semifoldl. The reason for this is that latter does not force the "inner" results (e.g. x1 `f` x2 in the above example) before applying them to the operator (e.g. to (`f` x3)). This results in a thunk chain \(\mathcal{O}(n)\) elements long, which then must be evaluated from the outside-in.

For a general Semifoldable structure this should be semantically identical to,

semifoldl f z = semifoldl f . toNonEmpty

semifoldl' :: (a -> a -> a) -> t a -> a Source #

Left-associative fold of a structure but with strict application of the operator.

This ensures that each step of the fold is forced to weak head normal form before being applied, avoiding the collection of thunks that would otherwise occur. This is often what you want to strictly reduce a finite list to a single, monolithic result (e.g. length).

For a general Semifoldable structure this should be semantically identical to,

semifoldl' f z = semifoldl f . toNonEmpty

toNonEmpty :: t a -> NonEmpty a Source #

List of elements of a structure, from left to right.

>>> toNonEmpty (Identity 2)
2 :| []

semimaximum :: forall a. Ord a => t a -> a Source #

The largest element of a non-empty structure.

>>> semimaximum (32 :| [64, 8, 128, 16])
128

semiminimum :: forall a. Ord a => t a -> a Source #

The least element of a non-empty structure.

>>> semiminimum (32 :| [64, 8, 128, 16])
8

semihead :: t a -> a Source #

The first element of a non-empty structure.

>>> semihead (1 :| [2, 3, 4])
1

semilast :: t a -> a Source #

The last element of a non-empty structure.

>>> semilast (1 :| [2, 3, 4])
4

semifoldrMap :: (a -> b) -> (a -> b -> b) -> t a -> b Source #

For Functors, semifoldrMap f g = semifoldr g . fmap g.

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> t a -> b Source #

For Functors, semifoldl'Map f g = semifoldl' g . fmap g.

semifoldlMap :: (a -> b) -> (b -> a -> b) -> t a -> b Source #

For Functors, semifoldlMap f g = semifoldl g . fmap g.

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> t a -> b Source #

For Functors, semifoldr'Map f g = semifoldr' g . fmap g.

Instances
Semifoldable Par1 Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Par1 m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Par1 a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Par1 a -> m Source #

semifoldr :: (a -> a -> a) -> Par1 a -> a Source #

semifoldr' :: (a -> a -> a) -> Par1 a -> a Source #

semifoldl :: (a -> a -> a) -> Par1 a -> a Source #

semifoldl' :: (a -> a -> a) -> Par1 a -> a Source #

toNonEmpty :: Par1 a -> NonEmpty a Source #

semimaximum :: Ord a => Par1 a -> a Source #

semiminimum :: Ord a => Par1 a -> a Source #

semihead :: Par1 a -> a Source #

semilast :: Par1 a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Par1 a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Par1 a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Par1 a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Par1 a -> b Source #

Semifoldable Complex Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Complex m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Complex a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Complex a -> m Source #

semifoldr :: (a -> a -> a) -> Complex a -> a Source #

semifoldr' :: (a -> a -> a) -> Complex a -> a Source #

semifoldl :: (a -> a -> a) -> Complex a -> a Source #

semifoldl' :: (a -> a -> a) -> Complex a -> a Source #

toNonEmpty :: Complex a -> NonEmpty a Source #

semimaximum :: Ord a => Complex a -> a Source #

semiminimum :: Ord a => Complex a -> a Source #

semihead :: Complex a -> a Source #

semilast :: Complex a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Complex a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Complex a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Complex a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Complex a -> b Source #

Semifoldable Min Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Min m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Min a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Min a -> m Source #

semifoldr :: (a -> a -> a) -> Min a -> a Source #

semifoldr' :: (a -> a -> a) -> Min a -> a Source #

semifoldl :: (a -> a -> a) -> Min a -> a Source #

semifoldl' :: (a -> a -> a) -> Min a -> a Source #

toNonEmpty :: Min a -> NonEmpty a Source #

semimaximum :: Ord a => Min a -> a Source #

semiminimum :: Ord a => Min a -> a Source #

semihead :: Min a -> a Source #

semilast :: Min a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Min a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Min a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Min a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Min a -> b Source #

Semifoldable Max Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Max m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Max a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Max a -> m Source #

semifoldr :: (a -> a -> a) -> Max a -> a Source #

semifoldr' :: (a -> a -> a) -> Max a -> a Source #

semifoldl :: (a -> a -> a) -> Max a -> a Source #

semifoldl' :: (a -> a -> a) -> Max a -> a Source #

toNonEmpty :: Max a -> NonEmpty a Source #

semimaximum :: Ord a => Max a -> a Source #

semiminimum :: Ord a => Max a -> a Source #

semihead :: Max a -> a Source #

semilast :: Max a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Max a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Max a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Max a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Max a -> b Source #

Semifoldable First Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => First m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> First a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> First a -> m Source #

semifoldr :: (a -> a -> a) -> First a -> a Source #

semifoldr' :: (a -> a -> a) -> First a -> a Source #

semifoldl :: (a -> a -> a) -> First a -> a Source #

semifoldl' :: (a -> a -> a) -> First a -> a Source #

toNonEmpty :: First a -> NonEmpty a Source #

semimaximum :: Ord a => First a -> a Source #

semiminimum :: Ord a => First a -> a Source #

semihead :: First a -> a Source #

semilast :: First a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> First a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> First a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> First a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> First a -> b Source #

Semifoldable Last Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Last m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Last a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Last a -> m Source #

semifoldr :: (a -> a -> a) -> Last a -> a Source #

semifoldr' :: (a -> a -> a) -> Last a -> a Source #

semifoldl :: (a -> a -> a) -> Last a -> a Source #

semifoldl' :: (a -> a -> a) -> Last a -> a Source #

toNonEmpty :: Last a -> NonEmpty a Source #

semimaximum :: Ord a => Last a -> a Source #

semiminimum :: Ord a => Last a -> a Source #

semihead :: Last a -> a Source #

semilast :: Last a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Last a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Last a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Last a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Last a -> b Source #

Semifoldable Identity Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Identity m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Identity a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Identity a -> m Source #

semifoldr :: (a -> a -> a) -> Identity a -> a Source #

semifoldr' :: (a -> a -> a) -> Identity a -> a Source #

semifoldl :: (a -> a -> a) -> Identity a -> a Source #

semifoldl' :: (a -> a -> a) -> Identity a -> a Source #

toNonEmpty :: Identity a -> NonEmpty a Source #

semimaximum :: Ord a => Identity a -> a Source #

semiminimum :: Ord a => Identity a -> a Source #

semihead :: Identity a -> a Source #

semilast :: Identity a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Identity a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Identity a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Identity a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Identity a -> b Source #

Semifoldable Dual Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Dual m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Dual a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Dual a -> m Source #

semifoldr :: (a -> a -> a) -> Dual a -> a Source #

semifoldr' :: (a -> a -> a) -> Dual a -> a Source #

semifoldl :: (a -> a -> a) -> Dual a -> a Source #

semifoldl' :: (a -> a -> a) -> Dual a -> a Source #

toNonEmpty :: Dual a -> NonEmpty a Source #

semimaximum :: Ord a => Dual a -> a Source #

semiminimum :: Ord a => Dual a -> a Source #

semihead :: Dual a -> a Source #

semilast :: Dual a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Dual a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Dual a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Dual a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Dual a -> b Source #

Semifoldable Sum Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Sum m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Sum a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Sum a -> m Source #

semifoldr :: (a -> a -> a) -> Sum a -> a Source #

semifoldr' :: (a -> a -> a) -> Sum a -> a Source #

semifoldl :: (a -> a -> a) -> Sum a -> a Source #

semifoldl' :: (a -> a -> a) -> Sum a -> a Source #

toNonEmpty :: Sum a -> NonEmpty a Source #

semimaximum :: Ord a => Sum a -> a Source #

semiminimum :: Ord a => Sum a -> a Source #

semihead :: Sum a -> a Source #

semilast :: Sum a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Sum a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Sum a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Sum a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Sum a -> b Source #

Semifoldable Product Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Product m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Product a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Product a -> m Source #

semifoldr :: (a -> a -> a) -> Product a -> a Source #

semifoldr' :: (a -> a -> a) -> Product a -> a Source #

semifoldl :: (a -> a -> a) -> Product a -> a Source #

semifoldl' :: (a -> a -> a) -> Product a -> a Source #

toNonEmpty :: Product a -> NonEmpty a Source #

semimaximum :: Ord a => Product a -> a Source #

semiminimum :: Ord a => Product a -> a Source #

semihead :: Product a -> a Source #

semilast :: Product a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Product a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Product a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Product a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Product a -> b Source #

Semifoldable Down Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Down m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Down a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Down a -> m Source #

semifoldr :: (a -> a -> a) -> Down a -> a Source #

semifoldr' :: (a -> a -> a) -> Down a -> a Source #

semifoldl :: (a -> a -> a) -> Down a -> a Source #

semifoldl' :: (a -> a -> a) -> Down a -> a Source #

toNonEmpty :: Down a -> NonEmpty a Source #

semimaximum :: Ord a => Down a -> a Source #

semiminimum :: Ord a => Down a -> a Source #

semihead :: Down a -> a Source #

semilast :: Down a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Down a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Down a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Down a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Down a -> b Source #

Semifoldable NonEmpty Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => NonEmpty m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> NonEmpty a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> NonEmpty a -> m Source #

semifoldr :: (a -> a -> a) -> NonEmpty a -> a Source #

semifoldr' :: (a -> a -> a) -> NonEmpty a -> a Source #

semifoldl :: (a -> a -> a) -> NonEmpty a -> a Source #

semifoldl' :: (a -> a -> a) -> NonEmpty a -> a Source #

toNonEmpty :: NonEmpty a -> NonEmpty a Source #

semimaximum :: Ord a => NonEmpty a -> a Source #

semiminimum :: Ord a => NonEmpty a -> a Source #

semihead :: NonEmpty a -> a Source #

semilast :: NonEmpty a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> NonEmpty a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> NonEmpty a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> NonEmpty a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> NonEmpty a -> b Source #

Semifoldable Tree Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Tree m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Tree a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Tree a -> m Source #

semifoldr :: (a -> a -> a) -> Tree a -> a Source #

semifoldr' :: (a -> a -> a) -> Tree a -> a Source #

semifoldl :: (a -> a -> a) -> Tree a -> a Source #

semifoldl' :: (a -> a -> a) -> Tree a -> a Source #

toNonEmpty :: Tree a -> NonEmpty a Source #

semimaximum :: Ord a => Tree a -> a Source #

semiminimum :: Ord a => Tree a -> a Source #

semihead :: Tree a -> a Source #

semilast :: Tree a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Tree a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Tree a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Tree a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Tree a -> b Source #

Semifoldable (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => V1 m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> V1 a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> V1 a -> m Source #

semifoldr :: (a -> a -> a) -> V1 a -> a Source #

semifoldr' :: (a -> a -> a) -> V1 a -> a Source #

semifoldl :: (a -> a -> a) -> V1 a -> a Source #

semifoldl' :: (a -> a -> a) -> V1 a -> a Source #

toNonEmpty :: V1 a -> NonEmpty a Source #

semimaximum :: Ord a => V1 a -> a Source #

semiminimum :: Ord a => V1 a -> a Source #

semihead :: V1 a -> a Source #

semilast :: V1 a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> V1 a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> V1 a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> V1 a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> V1 a -> b Source #

Semifoldable ((,) a) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => (a, m) -> m Source #

semifoldMap :: Semigroup m => (a0 -> m) -> (a, a0) -> m Source #

semifoldMap' :: Semigroup m => (a0 -> m) -> (a, a0) -> m Source #

semifoldr :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

semifoldr' :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

semifoldl :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

semifoldl' :: (a0 -> a0 -> a0) -> (a, a0) -> a0 Source #

toNonEmpty :: (a, a0) -> NonEmpty a0 Source #

semimaximum :: Ord a0 => (a, a0) -> a0 Source #

semiminimum :: Ord a0 => (a, a0) -> a0 Source #

semihead :: (a, a0) -> a0 Source #

semilast :: (a, a0) -> a0 Source #

semifoldrMap :: (a0 -> b) -> (a0 -> b -> b) -> (a, a0) -> b Source #

semifoldl'Map :: (a0 -> b) -> (b -> a0 -> b) -> (a, a0) -> b Source #

semifoldlMap :: (a0 -> b) -> (b -> a0 -> b) -> (a, a0) -> b Source #

semifoldr'Map :: (a0 -> b) -> (a0 -> b -> b) -> (a, a0) -> b Source #

Semifoldable f => Semifoldable (Lift f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Lift f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Lift f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Lift f a -> m Source #

semifoldr :: (a -> a -> a) -> Lift f a -> a Source #

semifoldr' :: (a -> a -> a) -> Lift f a -> a Source #

semifoldl :: (a -> a -> a) -> Lift f a -> a Source #

semifoldl' :: (a -> a -> a) -> Lift f a -> a Source #

toNonEmpty :: Lift f a -> NonEmpty a Source #

semimaximum :: Ord a => Lift f a -> a Source #

semiminimum :: Ord a => Lift f a -> a Source #

semihead :: Lift f a -> a Source #

semilast :: Lift f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Lift f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Lift f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Lift f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Lift f a -> b Source #

Semifoldable f => Semifoldable (Rec1 f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Rec1 f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Rec1 f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Rec1 f a -> m Source #

semifoldr :: (a -> a -> a) -> Rec1 f a -> a Source #

semifoldr' :: (a -> a -> a) -> Rec1 f a -> a Source #

semifoldl :: (a -> a -> a) -> Rec1 f a -> a Source #

semifoldl' :: (a -> a -> a) -> Rec1 f a -> a Source #

toNonEmpty :: Rec1 f a -> NonEmpty a Source #

semimaximum :: Ord a => Rec1 f a -> a Source #

semiminimum :: Ord a => Rec1 f a -> a Source #

semihead :: Rec1 f a -> a Source #

semilast :: Rec1 f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Rec1 f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Rec1 f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Rec1 f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Rec1 f a -> b Source #

Semifoldable f => Semifoldable (Ap f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Ap f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Ap f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Ap f a -> m Source #

semifoldr :: (a -> a -> a) -> Ap f a -> a Source #

semifoldr' :: (a -> a -> a) -> Ap f a -> a Source #

semifoldl :: (a -> a -> a) -> Ap f a -> a Source #

semifoldl' :: (a -> a -> a) -> Ap f a -> a Source #

toNonEmpty :: Ap f a -> NonEmpty a Source #

semimaximum :: Ord a => Ap f a -> a Source #

semiminimum :: Ord a => Ap f a -> a Source #

semihead :: Ap f a -> a Source #

semilast :: Ap f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Ap f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Ap f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Ap f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Ap f a -> b Source #

Semifoldable f => Semifoldable (Alt f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Alt f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Alt f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Alt f a -> m Source #

semifoldr :: (a -> a -> a) -> Alt f a -> a Source #

semifoldr' :: (a -> a -> a) -> Alt f a -> a Source #

semifoldl :: (a -> a -> a) -> Alt f a -> a Source #

semifoldl' :: (a -> a -> a) -> Alt f a -> a Source #

toNonEmpty :: Alt f a -> NonEmpty a Source #

semimaximum :: Ord a => Alt f a -> a Source #

semiminimum :: Ord a => Alt f a -> a Source #

semihead :: Alt f a -> a Source #

semilast :: Alt f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Alt f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Alt f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Alt f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Alt f a -> b Source #

Semifoldable f => Semifoldable (Reverse f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Reverse f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Reverse f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Reverse f a -> m Source #

semifoldr :: (a -> a -> a) -> Reverse f a -> a Source #

semifoldr' :: (a -> a -> a) -> Reverse f a -> a Source #

semifoldl :: (a -> a -> a) -> Reverse f a -> a Source #

semifoldl' :: (a -> a -> a) -> Reverse f a -> a Source #

toNonEmpty :: Reverse f a -> NonEmpty a Source #

semimaximum :: Ord a => Reverse f a -> a Source #

semiminimum :: Ord a => Reverse f a -> a Source #

semihead :: Reverse f a -> a Source #

semilast :: Reverse f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Reverse f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Reverse f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Reverse f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Reverse f a -> b Source #

Semifoldable f => Semifoldable (IdentityT f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => IdentityT f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> IdentityT f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> IdentityT f a -> m Source #

semifoldr :: (a -> a -> a) -> IdentityT f a -> a Source #

semifoldr' :: (a -> a -> a) -> IdentityT f a -> a Source #

semifoldl :: (a -> a -> a) -> IdentityT f a -> a Source #

semifoldl' :: (a -> a -> a) -> IdentityT f a -> a Source #

toNonEmpty :: IdentityT f a -> NonEmpty a Source #

semimaximum :: Ord a => IdentityT f a -> a Source #

semiminimum :: Ord a => IdentityT f a -> a Source #

semihead :: IdentityT f a -> a Source #

semilast :: IdentityT f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> IdentityT f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> IdentityT f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> IdentityT f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> IdentityT f a -> b Source #

Semifoldable f => Semifoldable (Backwards f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Backwards f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Backwards f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Backwards f a -> m Source #

semifoldr :: (a -> a -> a) -> Backwards f a -> a Source #

semifoldr' :: (a -> a -> a) -> Backwards f a -> a Source #

semifoldl :: (a -> a -> a) -> Backwards f a -> a Source #

semifoldl' :: (a -> a -> a) -> Backwards f a -> a Source #

toNonEmpty :: Backwards f a -> NonEmpty a Source #

semimaximum :: Ord a => Backwards f a -> a Source #

semiminimum :: Ord a => Backwards f a -> a Source #

semihead :: Backwards f a -> a Source #

semilast :: Backwards f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Backwards f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Backwards f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Backwards f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Backwards f a -> b Source #

Semifoldable (Tagged b) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Tagged b m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Tagged b a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Tagged b a -> m Source #

semifoldr :: (a -> a -> a) -> Tagged b a -> a Source #

semifoldr' :: (a -> a -> a) -> Tagged b a -> a Source #

semifoldl :: (a -> a -> a) -> Tagged b a -> a Source #

semifoldl' :: (a -> a -> a) -> Tagged b a -> a Source #

toNonEmpty :: Tagged b a -> NonEmpty a Source #

semimaximum :: Ord a => Tagged b a -> a Source #

semiminimum :: Ord a => Tagged b a -> a Source #

semihead :: Tagged b a -> a Source #

semilast :: Tagged b a -> a Source #

semifoldrMap :: (a -> b0) -> (a -> b0 -> b0) -> Tagged b a -> b0 Source #

semifoldl'Map :: (a -> b0) -> (b0 -> a -> b0) -> Tagged b a -> b0 Source #

semifoldlMap :: (a -> b0) -> (b0 -> a -> b0) -> Tagged b a -> b0 Source #

semifoldr'Map :: (a -> b0) -> (a -> b0 -> b0) -> Tagged b a -> b0 Source #

(Semifoldable f, Semifoldable g) => Semifoldable (f :+: g) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => (f :+: g) m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> (f :+: g) a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> (f :+: g) a -> m Source #

semifoldr :: (a -> a -> a) -> (f :+: g) a -> a Source #

semifoldr' :: (a -> a -> a) -> (f :+: g) a -> a Source #

semifoldl :: (a -> a -> a) -> (f :+: g) a -> a Source #

semifoldl' :: (a -> a -> a) -> (f :+: g) a -> a Source #

toNonEmpty :: (f :+: g) a -> NonEmpty a Source #

semimaximum :: Ord a => (f :+: g) a -> a Source #

semiminimum :: Ord a => (f :+: g) a -> a Source #

semihead :: (f :+: g) a -> a Source #

semilast :: (f :+: g) a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> (f :+: g) a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> (f :+: g) a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> (f :+: g) a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> (f :+: g) a -> b Source #

(Semifoldable f, Semifoldable g) => Semifoldable (f :*: g) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => (f :*: g) m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> (f :*: g) a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> (f :*: g) a -> m Source #

semifoldr :: (a -> a -> a) -> (f :*: g) a -> a Source #

semifoldr' :: (a -> a -> a) -> (f :*: g) a -> a Source #

semifoldl :: (a -> a -> a) -> (f :*: g) a -> a Source #

semifoldl' :: (a -> a -> a) -> (f :*: g) a -> a Source #

toNonEmpty :: (f :*: g) a -> NonEmpty a Source #

semimaximum :: Ord a => (f :*: g) a -> a Source #

semiminimum :: Ord a => (f :*: g) a -> a Source #

semihead :: (f :*: g) a -> a Source #

semilast :: (f :*: g) a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> (f :*: g) a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> (f :*: g) a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> (f :*: g) a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> (f :*: g) a -> b Source #

(Semifoldable f, Semifoldable g) => Semifoldable (Product f g) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Product f g m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Product f g a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Product f g a -> m Source #

semifoldr :: (a -> a -> a) -> Product f g a -> a Source #

semifoldr' :: (a -> a -> a) -> Product f g a -> a Source #

semifoldl :: (a -> a -> a) -> Product f g a -> a Source #

semifoldl' :: (a -> a -> a) -> Product f g a -> a Source #

toNonEmpty :: Product f g a -> NonEmpty a Source #

semimaximum :: Ord a => Product f g a -> a Source #

semiminimum :: Ord a => Product f g a -> a Source #

semihead :: Product f g a -> a Source #

semilast :: Product f g a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Product f g a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Product f g a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Product f g a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Product f g a -> b Source #

(Semifoldable f, Semifoldable g) => Semifoldable (Sum f g) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Sum f g m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Sum f g a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Sum f g a -> m Source #

semifoldr :: (a -> a -> a) -> Sum f g a -> a Source #

semifoldr' :: (a -> a -> a) -> Sum f g a -> a Source #

semifoldl :: (a -> a -> a) -> Sum f g a -> a Source #

semifoldl' :: (a -> a -> a) -> Sum f g a -> a Source #

toNonEmpty :: Sum f g a -> NonEmpty a Source #

semimaximum :: Ord a => Sum f g a -> a Source #

semiminimum :: Ord a => Sum f g a -> a Source #

semihead :: Sum f g a -> a Source #

semilast :: Sum f g a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Sum f g a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Sum f g a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Sum f g a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Sum f g a -> b Source #

Semifoldable f => Semifoldable (M1 i c f) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => M1 i c f m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> M1 i c f a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> M1 i c f a -> m Source #

semifoldr :: (a -> a -> a) -> M1 i c f a -> a Source #

semifoldr' :: (a -> a -> a) -> M1 i c f a -> a Source #

semifoldl :: (a -> a -> a) -> M1 i c f a -> a Source #

semifoldl' :: (a -> a -> a) -> M1 i c f a -> a Source #

toNonEmpty :: M1 i c f a -> NonEmpty a Source #

semimaximum :: Ord a => M1 i c f a -> a Source #

semiminimum :: Ord a => M1 i c f a -> a Source #

semihead :: M1 i c f a -> a Source #

semilast :: M1 i c f a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> M1 i c f a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> M1 i c f a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> M1 i c f a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> M1 i c f a -> b Source #

(Semifoldable f, Semifoldable g) => Semifoldable (f :.: g) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => (f :.: g) m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> (f :.: g) a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> (f :.: g) a -> m Source #

semifoldr :: (a -> a -> a) -> (f :.: g) a -> a Source #

semifoldr' :: (a -> a -> a) -> (f :.: g) a -> a Source #

semifoldl :: (a -> a -> a) -> (f :.: g) a -> a Source #

semifoldl' :: (a -> a -> a) -> (f :.: g) a -> a Source #

toNonEmpty :: (f :.: g) a -> NonEmpty a Source #

semimaximum :: Ord a => (f :.: g) a -> a Source #

semiminimum :: Ord a => (f :.: g) a -> a Source #

semihead :: (f :.: g) a -> a Source #

semilast :: (f :.: g) a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> (f :.: g) a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> (f :.: g) a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> (f :.: g) a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> (f :.: g) a -> b Source #

(Semifoldable f, Semifoldable g) => Semifoldable (Compose f g) Source # 
Instance details

Defined in Data.Semifoldable

Methods

semifold :: Semigroup m => Compose f g m -> m Source #

semifoldMap :: Semigroup m => (a -> m) -> Compose f g a -> m Source #

semifoldMap' :: Semigroup m => (a -> m) -> Compose f g a -> m Source #

semifoldr :: (a -> a -> a) -> Compose f g a -> a Source #

semifoldr' :: (a -> a -> a) -> Compose f g a -> a Source #

semifoldl :: (a -> a -> a) -> Compose f g a -> a Source #

semifoldl' :: (a -> a -> a) -> Compose f g a -> a Source #

toNonEmpty :: Compose f g a -> NonEmpty a Source #

semimaximum :: Ord a => Compose f g a -> a Source #

semiminimum :: Ord a => Compose f g a -> a Source #

semihead :: Compose f g a -> a Source #

semilast :: Compose f g a -> a Source #

semifoldrMap :: (a -> b) -> (a -> b -> b) -> Compose f g a -> b Source #

semifoldl'Map :: (a -> b) -> (b -> a -> b) -> Compose f g a -> b Source #

semifoldlMap :: (a -> b) -> (b -> a -> b) -> Compose f g a -> b Source #

semifoldr'Map :: (a -> b) -> (a -> b -> b) -> Compose f g a -> b Source #

intercalate1 :: (Semifoldable t, Semigroup m) => m -> t m -> m Source #

Insert an m between each pair of t m.

>>> intercalate1 ", " $ "hello" :| ["how", "are", "you"]
"hello, how, are, you"
>>> intercalate1 ", " $ "hello" :| []
"hello"
>>> intercalate1 mempty $ "I" :| ["Am", "Fine", "You?"]
"IAmFineYou?"

semifoldrM :: (Semifoldable t, Monad m) => (a -> a -> m a) -> t a -> m a Source #

Monadic fold over the elements of a non-empty structure, associating to the right, i.e. from right to left.

semifoldlM :: (Semifoldable t, Monad m) => (a -> a -> m a) -> t a -> m a Source #

Monadic fold over the elements of a non-empty structure, associating to the left, i.e. from left to right.

semifoldrMapM :: (Semifoldable t, Monad m) => (a -> m b) -> (a -> b -> m b) -> t a -> m b Source #

Map variant of semifoldrM.

semifoldlMapM :: (Semifoldable t, Monad m) => (a -> m b) -> (b -> a -> m b) -> t a -> m b Source #

Map variant of semifoldlM.

semimaximumBy :: Semifoldable t => (a -> a -> Ordering) -> t a -> a Source #

The largest element of a non-empty structure with respect to the given comparison function.

semiminimumBy :: Semifoldable t => (a -> a -> Ordering) -> t a -> a Source #

The least element of a non-empty structure with respect to the given comparison function.