semigroupoids-5.1: 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 | Haskell98

Data.Semigroup.Foldable

Description

Synopsis

- class Foldable t => Foldable1 t where
- intercalate1 :: (Foldable1 t, Semigroup m) => m -> t m -> m
- intercalateMap1 :: (Foldable1 t, Semigroup m) => m -> (a -> m) -> t a -> m
- traverse1_ :: (Foldable1 t, Apply f) => (a -> f b) -> t a -> f ()
- for1_ :: (Foldable1 t, Apply f) => t a -> (a -> f b) -> f ()
- sequenceA1_ :: (Foldable1 t, Apply f) => t (f a) -> f ()
- foldMapDefault1 :: (Foldable1 t, Monoid m) => (a -> m) -> t a -> m
- asum1 :: (Foldable1 t, Alt m) => t (m a) -> m a

# Documentation

class Foldable t => Foldable1 t where #

Methods

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

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

Instances

Foldable1 Identity # |
Methods fold1 :: Semigroup m => Identity m -> m # foldMap1 :: Semigroup m => (a -> m) -> Identity a -> m #
Foldable1 NonEmpty # |
Methods fold1 :: Semigroup m => NonEmpty m -> m # foldMap1 :: Semigroup m => (a -> m) -> NonEmpty a -> m #
Foldable1 Tree # |
Methods fold1 :: Semigroup m => Tree m -> m # foldMap1 :: Semigroup m => (a -> m) -> Tree a -> m #
Foldable1 ((,) a) # |
Methods fold1 :: Semigroup m => (a, m) -> m # foldMap1 :: Semigroup m => (a -> m) -> (a, a) -> m #
Foldable1 f => Foldable1 (Lift f) # |
Methods fold1 :: Semigroup m => Lift f m -> m # foldMap1 :: Semigroup m => (a -> m) -> Lift f a -> m #
Bifoldable1 p => Foldable1 (Join * p) # |
Methods fold1 :: Semigroup m => Join * p m -> m # foldMap1 :: Semigroup m => (a -> m) -> Join * p a -> m #
Foldable1 m => Foldable1 (IdentityT * m) # |
Methods fold1 :: Semigroup m => IdentityT * m m -> m # foldMap1 :: Semigroup m => (a -> m) -> IdentityT * m a -> m #
Foldable1 f => Foldable1 (Reverse * f) # |
Methods fold1 :: Semigroup m => Reverse * f m -> m # foldMap1 :: Semigroup m => (a -> m) -> Reverse * f a -> m #
Foldable1 f => Foldable1 (Backwards * f) # |
Methods fold1 :: Semigroup m => Backwards * f m -> m # foldMap1 :: Semigroup m => (a -> m) -> Backwards * f a -> m #
(Foldable1 f, Foldable1 g) => Foldable1 (Sum * f g) # |
Methods fold1 :: Semigroup m => Sum * f g m -> m # foldMap1 :: Semigroup m => (a -> m) -> Sum * f g a -> m #
(Foldable1 f, Foldable1 g) => Foldable1 (Product * f g) # |
Methods fold1 :: Semigroup m => Product * f g m -> m # foldMap1 :: Semigroup m => (a -> m) -> Product * f g a -> m #
(Foldable1 f, Foldable1 g) => Foldable1 (Compose * * f g) # |
Methods fold1 :: Semigroup m => Compose * * f g m -> m # foldMap1 :: Semigroup m => (a -> m) -> Compose * * f g a -> m #
Foldable1 g => Foldable1 (Joker * * g a) # |
Methods fold1 :: Semigroup m => Joker * * g a m -> m # foldMap1 :: Semigroup m => (a -> m) -> Joker * * g a a -> m #

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

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 #

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 () #

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

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

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

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

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