semigroupoids-5.3.7: Semigroupoids: Category sans id
Copyright (C) 2011-2015 Edward Kmett
License BSD-style (see the file LICENSE)
Maintainer Edward Kmett <ekmett@gmail.com>
Stability provisional
Portability portable
Safe Haskell Safe
Language Haskell2010

Data.Semigroup.Foldable

Description

Synopsis

Documentation

class Foldable t => Foldable1 t where Source #

Minimal complete definition

Nothing

Instances

Instances details
Foldable1 Par1 Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Complex Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Min Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Max Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 First Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Last Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Identity Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Dual Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Sum Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Product Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 NonEmpty Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 Tree Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

Foldable1 ( (,) a) Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Methods

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

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

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

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

Bifoldable1 p => Foldable1 ( Join p) Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 m => Foldable1 ( IdentityT m) Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

Foldable1 ( Tagged a) Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

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

Defined in Data.Semigroup.Foldable.Class

Foldable1 g => Foldable1 ( Joker g a) Source #
Instance details

Defined in Data.Semigroup.Foldable.Class

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 #

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