Data.Foldable1.WithIndex

indexed-traversable-0.1.3: FunctorWithIndex, FoldableWithIndex, TraversableWithIndex

Safe Haskell | Safe
Language | Haskell2010

Data.Foldable1.WithIndex

Contents

- Indexed Foldables

Description

Indexed non-empty Foldables.

Synopsis

- class (Foldable1 f, FoldableWithIndex i f) => Foldable1WithIndex i (f :: Type -> Type) | f -> i where
  - ifoldMap1 :: Semigroup m => (i -> a -> m) -> f a -> m
  - ifoldMap1' :: Semigroup m => (i -> a -> m) -> f a -> m
  - ifoldrMap1 :: (i -> a -> b) -> (i -> a -> b -> b) -> f a -> b
  - ifoldlMap1' :: (i -> a -> b) -> (i -> b -> a -> b) -> f a -> b
  - ifoldlMap1 :: (i -> a -> b) -> (i -> b -> a -> b) -> f a -> b
  - ifoldrMap1' :: (i -> a -> b) -> (i -> a -> b -> b) -> f a -> b

# Indexed Foldables

class (Foldable1 f, FoldableWithIndex i f) => Foldable1WithIndex i (f :: Type -> Type) | f -> i where #

A non-empty container that supports folding with an additional index.

Minimal complete definition

ifoldMap1 | ifoldrMap1

Methods

ifoldMap1 :: Semigroup m => (i -> a -> m) -> f a -> m #

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

ifoldMap1' :: Semigroup m => (i -> a -> m) -> f a -> m #

A variant of `ifoldMap1` that is strict in the accumulator.

ifoldrMap1 :: (i -> a -> b) -> (i -> a -> b -> b) -> f a -> b #

Generalized `ifoldr1`.

ifoldlMap1' :: (i -> a -> b) -> (i -> b -> a -> b) -> f a -> b #

Generalized `ifoldl1'`.

ifoldlMap1 :: (i -> a -> b) -> (i -> b -> a -> b) -> f a -> b #

Generalized `ifoldl1`.

ifoldrMap1' :: (i -> a -> b) -> (i -> a -> b -> b) -> f a -> b #

Generalized `ifoldr1'`.

#### Instances

Instances details

Foldable1WithIndex Int NonEmpty # |
Instance details Defined in WithIndex Methods ifoldMap1 :: Semigroup m => (Int -> a -> m) -> NonEmpty a -> m # ifoldMap1' :: Semigroup m => (Int -> a -> m) -> NonEmpty a -> m # ifoldrMap1 :: (Int -> a -> b) -> (Int -> a -> b -> b) -> NonEmpty a -> b # ifoldlMap1' :: (Int -> a -> b) -> (Int -> b -> a -> b) -> NonEmpty a -> b # ifoldlMap1 :: (Int -> a -> b) -> (Int -> b -> a -> b) -> NonEmpty a -> b # ifoldrMap1' :: (Int -> a -> b) -> (Int -> a -> b -> b) -> NonEmpty a -> b #