semigroupoids-5.2.1: Semigroupoids: Category sans id

Copyright(C) 2011-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Data.Semigroup.Foldable

Description

 

Synopsis

Documentation

class Foldable t => Foldable1 t where Source #

Methods

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

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

toNonEmpty :: t a -> NonEmpty a Source #

Instances

Foldable1 V1 Source # 

Methods

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

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

toNonEmpty :: V1 a -> NonEmpty a Source #

Foldable1 Par1 Source # 

Methods

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

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

toNonEmpty :: Par1 a -> NonEmpty a Source #

Foldable1 Identity Source # 

Methods

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

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

toNonEmpty :: Identity a -> NonEmpty a Source #

Foldable1 NonEmpty Source # 

Methods

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

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

toNonEmpty :: NonEmpty a -> NonEmpty a Source #

Foldable1 Complex Source # 

Methods

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

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

toNonEmpty :: Complex a -> NonEmpty a Source #

Foldable1 Tree Source # 

Methods

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

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

toNonEmpty :: Tree a -> NonEmpty a Source #

Foldable1 f => Foldable1 (Rec1 f) Source # 

Methods

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

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

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

Foldable1 ((,) a) Source # 

Methods

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

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

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

Foldable1 f => Foldable1 (Lift f) Source # 

Methods

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

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

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

(Foldable1 f, Foldable1 g) => Foldable1 ((:+:) f g) Source # 

Methods

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

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

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

(Foldable1 f, Foldable1 g) => Foldable1 ((:*:) f g) Source # 

Methods

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

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

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

(Foldable1 f, Foldable1 g) => Foldable1 ((:.:) f g) Source # 

Methods

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

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

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

Bifoldable1 p => Foldable1 (Join * p) Source # 

Methods

fold1 :: Semigroup m => Join * p m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Join * p a -> m Source #

toNonEmpty :: Join * p a -> NonEmpty a Source #

Foldable1 m => Foldable1 (IdentityT * m) Source # 

Methods

fold1 :: Semigroup m => IdentityT * m m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> IdentityT * m a -> m Source #

toNonEmpty :: IdentityT * m a -> NonEmpty a Source #

Foldable1 (Tagged * a) Source # 

Methods

fold1 :: Semigroup m => Tagged * a m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Tagged * a a -> m Source #

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

Foldable1 f => Foldable1 (Reverse * f) Source # 

Methods

fold1 :: Semigroup m => Reverse * f m -> m Source #

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

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

Foldable1 f => Foldable1 (Backwards * f) Source # 

Methods

fold1 :: Semigroup m => Backwards * f m -> m Source #

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

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

Foldable1 f => Foldable1 (M1 i c f) Source # 

Methods

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

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

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

(Foldable1 f, Foldable1 g) => Foldable1 (Sum * f g) Source # 

Methods

fold1 :: Semigroup m => Sum * f g m -> m Source #

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

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

(Foldable1 f, Foldable1 g) => Foldable1 (Product * f g) Source # 

Methods

fold1 :: Semigroup m => Product * f g m -> m Source #

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

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

(Foldable1 f, Foldable1 g) => Foldable1 (Compose * * f g) Source # 

Methods

fold1 :: Semigroup m => Compose * * f g m -> m Source #

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

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

Foldable1 g => Foldable1 (Joker * * g a) Source # 

Methods

fold1 :: Semigroup m => Joker * * g a m -> m Source #

foldMap1 :: Semigroup m => (a -> m) -> Joker * * g a a -> m Source #

toNonEmpty :: Joker * * g a a -> NonEmpty a Source #

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

Insert an m between each pair of 't m'. Equivalent to intercalateMap1 with id as the second argument.

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

intercalateMap1 :: (Foldable1 t, Semigroup m) => m -> (a -> m) -> t a -> m Source #

Insert m between each pair of m derived from a.

>>> intercalateMap1 " " show $ True :| [False, True]
"True False True"
>>> intercalateMap1 " " show $ True :| []
"True"

traverse1_ :: (Foldable1 t, Apply f) => (a -> f b) -> t a -> f () Source #

for1_ :: (Foldable1 t, Apply f) => t a -> (a -> f b) -> f () Source #

sequenceA1_ :: (Foldable1 t, Apply f) => t (f a) -> f () Source #

foldMapDefault1 :: (Foldable1 t, Monoid m) => (a -> m) -> t a -> m Source #

Usable default for foldMap, but only if you define foldMap1 yourself

asum1 :: (Foldable1 t, Alt m) => t (m a) -> m a Source #

foldrM1 :: (Foldable1 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.

let g = (=<<) . f
in foldrM1 f (x1 :| [x2, ..., xn]) == x1 `g` (x2 `g` ... (xn-1 `f` xn)...)

foldlM1 :: (Foldable1 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.

let g = flip $ (=<<) . f
in foldlM1 f (x1 :| [x2, ..., xn]) == (...((x1 `f` x2) `g` x2) `g`...) `g` xn