optics-core-0.4.1.1: Optics as an abstract interface: core definitions

Safe Haskell | None
Language | Haskell2010

Optics.IxFold

Contents

- Formation
- Introduction
- Elimination
- Additional introduction forms
- Additional elimination forms
- Combinators
- Monoid structures
- Subtyping
- Re-exports

Description

An `IxFold` is an indexed version of a `Fold`. See the "Indexed optics" section of the overview documentation in the `Optics` module of the main `optics` package for more details on indexed optics.

Synopsis

- type IxFold i s a = Optic' A_Fold (WithIx i) s a
- ifoldVL :: (forall (f :: Type -> Type). Applicative f => (i -> a -> f u) -> s -> f v) -> IxFold i s a
- ifoldMapOf :: forall k m (is :: IxList) i s a. (Is k A_Fold, Monoid m, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> m) -> s -> m
- ifoldrOf :: forall k (is :: IxList) i s a r. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> r -> r) -> r -> s -> r
- ifoldlOf' :: forall k (is :: IxList) i s a r. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> r -> a -> r) -> r -> s -> r
- itoListOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> s -> [(i, a)]
- itraverseOf_ :: forall k f (is :: IxList) i s a r. (Is k A_Fold, Applicative f, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> f r) -> s -> f ()
- iforOf_ :: forall k f (is :: IxList) i s a r. (Is k A_Fold, Applicative f, HasSingleIndex is i) => Optic' k is s a -> s -> (i -> a -> f r) -> f ()
- ifolded :: FoldableWithIndex i f => IxFold i (f a) a
- ifolding :: FoldableWithIndex i f => (s -> f a) -> IxFold i s a
- ifoldring :: (forall (f :: Type -> Type). Applicative f => (i -> a -> f u -> f u) -> f v -> s -> f w) -> IxFold i s a
- iheadOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> s -> Maybe (i, a)
- ilastOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> s -> Maybe (i, a)
- ianyOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Bool
- iallOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Bool
- inoneOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Bool
- ifindOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Maybe (i, a)
- ifindMOf :: forall k m (is :: IxList) i s a. (Is k A_Fold, Monad m, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> m Bool) -> s -> m (Maybe (i, a))
- ipre :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> IxAffineFold i s a
- ifiltered :: forall k (is :: IxList) i a s. (Is k A_Fold, HasSingleIndex is i) => (i -> a -> Bool) -> Optic' k is s a -> IxFold i s a
- ibackwards_ :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> IxFold i s a
- isumming :: forall k l (is1 :: IxList) i (is2 :: IxList) s a. (Is k A_Fold, Is l A_Fold, HasSingleIndex is1 i, HasSingleIndex is2 i) => Optic' k is1 s a -> Optic' l is2 s a -> IxFold i s a
- ifailing :: forall k l (is1 :: IxList) i (is2 :: IxList) s a. (Is k A_Fold, Is l A_Fold, HasSingleIndex is1 i, HasSingleIndex is2 i) => Optic' k is1 s a -> Optic' l is2 s a -> IxFold i s a
- data A_Fold
- class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i where
  - ifoldMap :: Monoid m => (i -> a -> m) -> f a -> m
  - ifoldMap' :: Monoid m => (i -> a -> m) -> f a -> m
  - ifoldr :: (i -> a -> b -> b) -> b -> f a -> b
  - ifoldl :: (i -> b -> a -> b) -> b -> f a -> b
  - ifoldr' :: (i -> a -> b -> b) -> b -> f a -> b
  - ifoldl' :: (i -> b -> a -> b) -> b -> f a -> b

# Formation

type IxFold i s a = Optic' A_Fold (WithIx i) s a Source #

Type synonym for an indexed fold.

# Introduction

ifoldVL :: (forall (f :: Type -> Type). Applicative f => (i -> a -> f u) -> s -> f v) -> IxFold i s a Source #

Obtain an indexed fold by lifting `itraverse_` like function.

    ifoldVL . itraverseOf_ ≡ id
    itraverseOf_ . ifoldVL ≡ id

# Elimination

ifoldMapOf :: forall k m (is :: IxList) i s a. (Is k A_Fold, Monoid m, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> m) -> s -> m Source #

Fold with index via embedding into a monoid.

ifoldrOf :: forall k (is :: IxList) i s a r. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> r -> r) -> r -> s -> r Source #

Fold with index right-associatively.

ifoldlOf' :: forall k (is :: IxList) i s a r. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> r -> a -> r) -> r -> s -> r Source #

Fold with index left-associatively, and strictly.

itoListOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> s -> [(i, a)] Source #

Fold with index to a list.

    >>> itoListOf (folded % ifolded) ["abc", "def"]
    [(0,'a'),(1,'b'),(2,'c'),(0,'d'),(1,'e'),(2,'f')]

Note: currently indexed optics can be used as non-indexed.

    >>> toListOf (folded % ifolded) ["abc", "def"]
    "abcdef"

itraverseOf_ :: forall k f (is :: IxList) i s a r. (Is k A_Fold, Applicative f, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> f r) -> s -> f () Source #

Traverse over all of the targets of an `IxFold`, computing an `Applicative`-based answer, but unlike `itraverseOf` do not construct a new structure.

    >>> itraverseOf_ each (curry print) ("hello","world")
    (0,"hello")
    (1,"world")

iforOf_ :: forall k f (is :: IxList) i s a r. (Is k A_Fold, Applicative f, HasSingleIndex is i) => Optic' k is s a -> s -> (i -> a -> f r) -> f () Source #

A version of `itraverseOf_` with the arguments flipped.

# Additional introduction forms

ifolded :: FoldableWithIndex i f => IxFold i (f a) a Source #

Indexed fold via `FoldableWithIndex` class.

ifolding :: FoldableWithIndex i f => (s -> f a) -> IxFold i s a Source #

Obtain an `IxFold` by lifting an operation that returns a `FoldableWithIndex` result.

This can be useful to lift operations from `Data.List` and elsewhere into an `IxFold`.

    >>> itoListOf (ifolding words) "how are you"
    [(0,"how"),(1,"are"),(2,"you")]

ifoldring :: (forall (f :: Type -> Type). Applicative f => (i -> a -> f u -> f u) -> f v -> s -> f w) -> IxFold i s a Source #

Obtain an `IxFold` by lifting `ifoldr` like function.

    >>> itoListOf (ifoldring ifoldr) "hello"
    [(0,'h'),(1,'e'),(2,'l'),(3,'l'),(4,'o')]

# Additional elimination forms

See also `toMapOf`, which constructs a `Map` from an `IxFold`.

iheadOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> s -> Maybe (i, a) Source #

Retrieve the first entry of an `IxFold` along with its index.

    >>> iheadOf ifolded [1..10]
    Just (0,1)

ilastOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> s -> Maybe (i, a) Source #

Retrieve the last entry of an `IxFold` along with its index.

    >>> ilastOf ifolded [1..10]
    Just (9,10)

ianyOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Bool Source #

Return whether or not any element viewed through an `IxFold` satisfies a predicate, with access to the `i`.

When you don't need access to the index then `anyOf` is more flexible in what it accepts.

    anyOf o ≡ ianyOf o . const

iallOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Bool Source #

Return whether or not all elements viewed through an `IxFold` satisfy a predicate, with access to the `i`.

When you don't need access to the index then `allOf` is more flexible in what it accepts.

    allOf o ≡ iallOf o . const

inoneOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Bool Source #

Return whether or not none of the elements viewed through an `IxFold` satisfy a predicate, with access to the `i`.

When you don't need access to the index then `noneOf` is more flexible in what it accepts.

    noneOf o ≡ inoneOf o . const

ifindOf :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> Bool) -> s -> Maybe (i, a) Source #

The `ifindOf` function takes an `IxFold`, a predicate that is also supplied the index, a structure and returns the left-most element of the structure along with its index matching the predicate, or `Nothing` if there is no such element.

When you don't need access to the index then `findOf` is more flexible in what it accepts.

ifindMOf :: forall k m (is :: IxList) i s a. (Is k A_Fold, Monad m, HasSingleIndex is i) => Optic' k is s a -> (i -> a -> m Bool) -> s -> m (Maybe (i, a)) Source #

The `ifindMOf` function takes an `IxFold`, a monadic predicate that is also supplied the index, a structure and returns in the monad the left-most element of the structure matching the predicate, or `Nothing` if there is no such element.

When you don't need access to the index then `findMOf` is more flexible in what it accepts.

# Combinators

ipre :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> IxAffineFold i s a Source #

Convert an indexed fold to an `IxAffineFold` that visits the first element of the original fold.

For the traversal version see `isingular`.

ifiltered :: forall k (is :: IxList) i a s. (Is k A_Fold, HasSingleIndex is i) => (i -> a -> Bool) -> Optic' k is s a -> IxFold i s a Source #

Filter results of an `IxFold` that don't satisfy a predicate.

    >>> toListOf (ifolded %& ifiltered (>)) [3,2,1,0]
    [1,0]

ibackwards_ :: forall k (is :: IxList) i s a. (Is k A_Fold, HasSingleIndex is i) => Optic' k is s a -> IxFold i s a Source #

This allows you to traverse the elements of an `IxFold` in the opposite order.

# Monoid structures

`IxFold` admits (at least) two monoid structures:

- `isumming` concatenates results from both folds.
- `ifailing` returns results from the second fold only if the first returns no results.

In both cases, the identity element of the monoid is `ignored`, which returns no results.

There is no `Semigroup` or `Monoid` instance for `IxFold`, because there is not a unique choice of monoid to use, and the (`<>`) operator could not be used to combine optics of different kinds.

isumming :: forall k l (is1 :: IxList) i (is2 :: IxList) s a. (Is k A_Fold, Is l A_Fold, HasSingleIndex is1 i, HasSingleIndex is2 i) => Optic' k is1 s a -> Optic' l is2 s a -> IxFold i s a infixr 6 Source #

Return entries of the first `IxFold`, then the second one.

    >>> itoListOf (ifolded `isumming` ibackwards_ ifolded) ["a","b"]
    [(0,"a"),(1,"b"),(1,"b"),(0,"a")]

For the traversal version see `iadjoin`.

ifailing :: forall k l (is1 :: IxList) i (is2 :: IxList) s a. (Is k A_Fold, Is l A_Fold, HasSingleIndex is1 i, HasSingleIndex is2 i) => Optic' k is1 s a -> Optic' l is2 s a -> IxFold i s a infixl 3 Source #

Try the first `IxFold`. If it returns no entries, try the second one.

    >>> itoListOf (_1 % ifolded `ifailing` _2 % ifolded) (["a"], ["b","c"])
    [(0,"a")]
    >>> itoListOf (_1 % ifolded `ifailing` _2 % ifolded) ([], ["b","c"])
    [(0,"b"),(1,"c")]

# Subtyping

data A_Fold Source #

Tag for a fold.

#### Instances

Instances details

Is A_Getter A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Getter p => r) -> Constraints A_Fold p => r Source #
Is A_Lens A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Lens p => r) -> Constraints A_Fold p => r Source #
Is A_Prism A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Prism p => r) -> Constraints A_Fold p => r Source #
Is A_ReversedPrism A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_ReversedPrism p => r) -> Constraints A_Fold p => r Source #
Is A_Traversal A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_Traversal p => r) -> Constraints A_Fold p => r Source #
Is An_AffineFold A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineFold p => r) -> Constraints A_Fold p => r Source #
Is An_AffineTraversal A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_AffineTraversal p => r) -> Constraints A_Fold p => r Source #
Is An_Iso A_Fold Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_Fold p => r Source #
k ~ A_Fold => JoinKinds A_Fold A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold A_Getter k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Getter p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold A_Lens k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Lens p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold A_Prism k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Prism p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold A_ReversedPrism k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_ReversedPrism p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold A_Traversal k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints A_Traversal p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold An_AffineFold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints An_AffineFold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold An_AffineTraversal k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints An_AffineTraversal p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Fold An_Iso k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Fold p, Constraints An_Iso p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Getter A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Getter p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Lens A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Lens p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Prism A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_ReversedPrism A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedPrism p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds A_Traversal A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Traversal p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds An_AffineFold A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineFold p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds An_AffineTraversal A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_AffineTraversal p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
k ~ A_Fold => JoinKinds An_Iso A_Fold k Source # |
Instance details Defined in Optics.Internal.Optic.Subtyping Methods joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_Fold p) => r) -> Constraints k p => r Source #
(s ~ t, a ~ b) => IxOptic A_Fold s t a b Source # |
Instance details Defined in Optics.Indexed.Core Methods noIx :: forall (is :: IxList). NonEmptyIndices is => Optic A_Fold is s t a b -> Optic A_Fold NoIx s t a b Source #
(s ~ t, a ~ b) => ToReadOnly A_Fold s t a b Source # |

Instance details

Defined in Optics.ReadOnly

Associated Types

type ReadOnlyOptic A_Fold |
Instance details Defined in Optics.ReadOnly type ReadOnlyOptic A_Fold = A_Fold

Methods

getting :: forall (is :: IxList). Optic A_Fold is s t a b -> Optic' (ReadOnlyOptic A_Fold) is s a Source #

type ReadOnlyOptic A_Fold Source # |
Instance details Defined in Optics.ReadOnly type ReadOnlyOptic A_Fold = A_Fold

# Re-exports

class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i where Source #

A container that supports folding with an additional index.

Minimal complete definition

Nothing

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> f a -> m Source #

Fold a container by mapping value to an arbitrary `Monoid` with access to the index `i`.

When you don't need access to the index then `foldMap` is more flexible in what it accepts.

    foldMap ≡ ifoldMap . const

default ifoldMap :: (TraversableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m Source #

ifoldMap' :: Monoid m => (i -> a -> m) -> f a -> m Source #

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

When you don't need access to the index then `foldMap'` is more flexible in what it accepts.

    foldMap' ≡ ifoldMap' . const

ifoldr :: (i -> a -> b -> b) -> b -> f a -> b Source #

Right-associative fold of an indexed container with access to the index `i`.

When you don't need access to the index then `foldr` is more flexible in what it accepts.

    foldr ≡ ifoldr . const

ifoldl :: (i -> b -> a -> b) -> b -> f a -> b Source #

Left-associative fold of an indexed container with access to the index `i`.

When you don't need access to the index then `foldl` is more flexible in what it accepts.

    foldl ≡ ifoldl . const

ifoldr' :: (i -> a -> b -> b) -> b -> f a -> b Source #

Strictly fold right over the elements of a structure with access to the index `i`.

When you don't need access to the index then `foldr'` is more flexible in what it accepts.

    foldr' ≡ ifoldr' . const

ifoldl' :: (i -> b -> a -> b) -> b -> f a -> b Source #

Fold over the elements of a structure with an index, associating to the left, but strictly.

When you don't need access to the index then `foldlOf'` is more flexible in what it accepts.

    foldl' l ≡ ifoldl' l . const

#### Instances

Instances details

FoldableWithIndex () Identity |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (() -> a -> m) -> Identity a -> m Source #

ifoldMap' :: Monoid m => (() -> a -> m) -> Identity a -> m Source #

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

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

ifoldr' :: (() -> a -> b -> b) -> b -> Identity a -> b Source #

ifoldl' :: (() -> b -> a -> b) -> b -> Identity a -> b Source #

FoldableWithIndex () Par1 |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (() -> a -> m) -> Par1 a -> m Source #

ifoldMap' :: Monoid m => (() -> a -> m) -> Par1 a -> m Source #

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

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

ifoldr' :: (() -> a -> b -> b) -> b -> Par1 a -> b Source #

ifoldl' :: (() -> b -> a -> b) -> b -> Par1 a -> b Source #

FoldableWithIndex () Maybe |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (() -> a -> m) -> Maybe a -> m Source #

ifoldMap' :: Monoid m => (() -> a -> m) -> Maybe a -> m Source #

ifoldr :: (() -> a -> b -> b) -> b -> Maybe a -> b Source #

ifoldl :: (() -> b -> a -> b) -> b -> Maybe a -> b Source #

ifoldr' :: (() -> a -> b -> b) -> b -> Maybe a -> b Source #

ifoldl' :: (() -> b -> a -> b) -> b -> Maybe a -> b Source #

FoldableWithIndex Int IntMap |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Int -> a -> m) -> IntMap a -> m Source #

ifoldMap' :: Monoid m => (Int -> a -> m) -> IntMap a -> m Source #

ifoldr :: (Int -> a -> b -> b) -> b -> IntMap a -> b Source #

ifoldl :: (Int -> b -> a -> b) -> b -> IntMap a -> b Source #

ifoldr' :: (Int -> a -> b -> b) -> b -> IntMap a -> b Source #

ifoldl' :: (Int -> b -> a -> b) -> b -> IntMap a -> b Source #

FoldableWithIndex Int Seq |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Int -> a -> m) -> Seq a -> m Source #

ifoldMap' :: Monoid m => (Int -> a -> m) -> Seq a -> m Source #

ifoldr :: (Int -> a -> b -> b) -> b -> Seq a -> b Source #

ifoldl :: (Int -> b -> a -> b) -> b -> Seq a -> b Source #

ifoldr' :: (Int -> a -> b -> b) -> b -> Seq a -> b Source #

ifoldl' :: (Int -> b -> a -> b) -> b -> Seq a -> b Source #

FoldableWithIndex Int NonEmpty |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Int -> a -> m) -> NonEmpty a -> m Source #

ifoldMap' :: Monoid m => (Int -> a -> m) -> NonEmpty a -> m Source #

ifoldr :: (Int -> a -> b -> b) -> b -> NonEmpty a -> b Source #

ifoldl :: (Int -> b -> a -> b) -> b -> NonEmpty a -> b Source #

ifoldr' :: (Int -> a -> b -> b) -> b -> NonEmpty a -> b Source #

ifoldl' :: (Int -> b -> a -> b) -> b -> NonEmpty a -> b Source #

FoldableWithIndex Int ZipList |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Int -> a -> m) -> ZipList a -> m Source #

ifoldMap' :: Monoid m => (Int -> a -> m) -> ZipList a -> m Source #

ifoldr :: (Int -> a -> b -> b) -> b -> ZipList a -> b Source #

ifoldl :: (Int -> b -> a -> b) -> b -> ZipList a -> b Source #

ifoldr' :: (Int -> a -> b -> b) -> b -> ZipList a -> b Source #

ifoldl' :: (Int -> b -> a -> b) -> b -> ZipList a -> b Source #

FoldableWithIndex Int [] |
Instance details Defined in WithIndex Methods ifoldMap :: Monoid m => (Int -> a -> m) -> [a] -> m Source # ifoldMap' :: Monoid m => (Int -> a -> m) -> [a] -> m Source # ifoldr :: (Int -> a -> b -> b) -> b -> [a] -> b Source # ifoldl :: (Int -> b -> a -> b) -> b -> [a] -> b Source # ifoldr' :: (Int -> a -> b -> b) -> b -> [a] -> b Source # ifoldl' :: (Int -> b -> a -> b) -> b -> [a] -> b Source #
FoldableWithIndex Void (Proxy :: Type -> Type) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Void -> a -> m) -> Proxy a -> m Source #

ifoldMap' :: Monoid m => (Void -> a -> m) -> Proxy a -> m Source #

ifoldr :: (Void -> a -> b -> b) -> b -> Proxy a -> b Source #

ifoldl :: (Void -> b -> a -> b) -> b -> Proxy a -> b Source #

ifoldr' :: (Void -> a -> b -> b) -> b -> Proxy a -> b Source #

ifoldl' :: (Void -> b -> a -> b) -> b -> Proxy a -> b Source #

FoldableWithIndex Void (U1 :: Type -> Type) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Void -> a -> m) -> U1 a -> m Source #

ifoldMap' :: Monoid m => (Void -> a -> m) -> U1 a -> m Source #

ifoldr :: (Void -> a -> b -> b) -> b -> U1 a -> b Source #

ifoldl :: (Void -> b -> a -> b) -> b -> U1 a -> b Source #

ifoldr' :: (Void -> a -> b -> b) -> b -> U1 a -> b Source #

ifoldl' :: (Void -> b -> a -> b) -> b -> U1 a -> b Source #

FoldableWithIndex Void (V1 :: Type -> Type) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Void -> a -> m) -> V1 a -> m Source #

ifoldMap' :: Monoid m => (Void -> a -> m) -> V1 a -> m Source #

ifoldr :: (Void -> a -> b -> b) -> b -> V1 a -> b Source #

ifoldl :: (Void -> b -> a -> b) -> b -> V1 a -> b Source #

ifoldr' :: (Void -> a -> b -> b) -> b -> V1 a -> b Source #

ifoldl' :: (Void -> b -> a -> b) -> b -> V1 a -> b Source #

Ix i => FoldableWithIndex i (Array i) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> Array i a -> m Source #

ifoldMap' :: Monoid m => (i -> a -> m) -> Array i a -> m Source #

ifoldr :: (i -> a -> b -> b) -> b -> Array i a -> b Source #

ifoldl :: (i -> b -> a -> b) -> b -> Array i a -> b Source #

ifoldr' :: (i -> a -> b -> b) -> b -> Array i a -> b Source #

ifoldl' :: (i -> b -> a -> b) -> b -> Array i a -> b Source #

FoldableWithIndex k (Map k) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> Map k a -> m Source #

ifoldMap' :: Monoid m => (k -> a -> m) -> Map k a -> m Source #

ifoldr :: (k -> a -> b -> b) -> b -> Map k a -> b Source #

ifoldl :: (k -> b -> a -> b) -> b -> Map k a -> b Source #

ifoldr' :: (k -> a -> b -> b) -> b -> Map k a -> b Source #

ifoldl' :: (k -> b -> a -> b) -> b -> Map k a -> b Source #

FoldableWithIndex k ((,) k) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> (k, a) -> m Source #

ifoldMap' :: Monoid m => (k -> a -> m) -> (k, a) -> m Source #

ifoldr :: (k -> a -> b -> b) -> b -> (k, a) -> b Source #

ifoldl :: (k -> b -> a -> b) -> b -> (k, a) -> b Source #

ifoldr' :: (k -> a -> b -> b) -> b -> (k, a) -> b Source #

ifoldl' :: (k -> b -> a -> b) -> b -> (k, a) -> b Source #

FoldableWithIndex Void (Const e :: Type -> Type) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Void -> a -> m) -> Const e a -> m Source #

ifoldMap' :: Monoid m => (Void -> a -> m) -> Const e a -> m Source #

ifoldr :: (Void -> a -> b -> b) -> b -> Const e a -> b Source #

ifoldl :: (Void -> b -> a -> b) -> b -> Const e a -> b Source #

ifoldr' :: (Void -> a -> b -> b) -> b -> Const e a -> b Source #

ifoldl' :: (Void -> b -> a -> b) -> b -> Const e a -> b Source #

FoldableWithIndex Void (Constant e :: Type -> Type) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Void -> a -> m) -> Constant e a -> m Source #

ifoldMap' :: Monoid m => (Void -> a -> m) -> Constant e a -> m Source #

ifoldr :: (Void -> a -> b -> b) -> b -> Constant e a -> b Source #

ifoldl :: (Void -> b -> a -> b) -> b -> Constant e a -> b Source #

ifoldr' :: (Void -> a -> b -> b) -> b -> Constant e a -> b Source #

ifoldl' :: (Void -> b -> a -> b) -> b -> Constant e a -> b Source #

FoldableWithIndex i f => FoldableWithIndex i (Rec1 f) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> Rec1 f a -> m Source #

ifoldMap' :: Monoid m => (i -> a -> m) -> Rec1 f a -> m Source #

ifoldr :: (i -> a -> b -> b) -> b -> Rec1 f a -> b Source #

ifoldl :: (i -> b -> a -> b) -> b -> Rec1 f a -> b Source #

ifoldr' :: (i -> a -> b -> b) -> b -> Rec1 f a -> b Source #

ifoldl' :: (i -> b -> a -> b) -> b -> Rec1 f a -> b Source #

FoldableWithIndex i f => FoldableWithIndex i (Backwards f) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> Backwards f a -> m Source #

ifoldMap' :: Monoid m => (i -> a -> m) -> Backwards f a -> m Source #

ifoldr :: (i -> a -> b -> b) -> b -> Backwards f a -> b Source #

ifoldl :: (i -> b -> a -> b) -> b -> Backwards f a -> b Source #

ifoldr' :: (i -> a -> b -> b) -> b -> Backwards f a -> b Source #

ifoldl' :: (i -> b -> a -> b) -> b -> Backwards f a -> b Source #

FoldableWithIndex i m => FoldableWithIndex i (IdentityT m) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m0 => (i -> a -> m0) -> IdentityT m a -> m0 Source #

ifoldMap' :: Monoid m0 => (i -> a -> m0) -> IdentityT m a -> m0 Source #

ifoldr :: (i -> a -> b -> b) -> b -> IdentityT m a -> b Source #

ifoldl :: (i -> b -> a -> b) -> b -> IdentityT m a -> b Source #

ifoldr' :: (i -> a -> b -> b) -> b -> IdentityT m a -> b Source #

ifoldl' :: (i -> b -> a -> b) -> b -> IdentityT m a -> b Source #

FoldableWithIndex i f => FoldableWithIndex i (Reverse f) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (i -> a -> m) -> Reverse f a -> m Source #

ifoldMap' :: Monoid m => (i -> a -> m) -> Reverse f a -> m Source #

ifoldr :: (i -> a -> b -> b) -> b -> Reverse f a -> b Source #

ifoldl :: (i -> b -> a -> b) -> b -> Reverse f a -> b Source #

ifoldr' :: (i -> a -> b -> b) -> b -> Reverse f a -> b Source #

ifoldl' :: (i -> b -> a -> b) -> b -> Reverse f a -> b Source #

FoldableWithIndex Void (K1 i c :: Type -> Type) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Void -> a -> m) -> K1 i c a -> m Source #

ifoldMap' :: Monoid m => (Void -> a -> m) -> K1 i c a -> m Source #

ifoldr :: (Void -> a -> b -> b) -> b -> K1 i c a -> b Source #

ifoldl :: (Void -> b -> a -> b) -> b -> K1 i c a -> b Source #

ifoldr' :: (Void -> a -> b -> b) -> b -> K1 i c a -> b Source #

ifoldl' :: (Void -> b -> a -> b) -> b -> K1 i c a -> b Source #

FoldableWithIndex [Int] Tree |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => ([Int] -> a -> m) -> Tree a -> m Source #

ifoldMap' :: Monoid m => ([Int] -> a -> m) -> Tree a -> m Source #

ifoldr :: ([Int] -> a -> b -> b) -> b -> Tree a -> b Source #

ifoldl :: ([Int] -> b -> a -> b) -> b -> Tree a -> b Source #

ifoldr' :: ([Int] -> a -> b -> b) -> b -> Tree a -> b Source #

ifoldl' :: ([Int] -> b -> a -> b) -> b -> Tree a -> b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (Product f g) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Either i j -> a -> m) -> Product f g a -> m Source #

ifoldMap' :: Monoid m => (Either i j -> a -> m) -> Product f g a -> m Source #

ifoldr :: (Either i j -> a -> b -> b) -> b -> Product f g a -> b Source #

ifoldl :: (Either i j -> b -> a -> b) -> b -> Product f g a -> b Source #

ifoldr' :: (Either i j -> a -> b -> b) -> b -> Product f g a -> b Source #

ifoldl' :: (Either i j -> b -> a -> b) -> b -> Product f g a -> b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (Sum f g) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Either i j -> a -> m) -> Sum f g a -> m Source #

ifoldMap' :: Monoid m => (Either i j -> a -> m) -> Sum f g a -> m Source #

ifoldr :: (Either i j -> a -> b -> b) -> b -> Sum f g a -> b Source #

ifoldl :: (Either i j -> b -> a -> b) -> b -> Sum f g a -> b Source #

ifoldr' :: (Either i j -> a -> b -> b) -> b -> Sum f g a -> b Source #

ifoldl' :: (Either i j -> b -> a -> b) -> b -> Sum f g a -> b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (f :*: g) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Either i j -> a -> m) -> (f :*: g) a -> m Source #

ifoldMap' :: Monoid m => (Either i j -> a -> m) -> (f :*: g) a -> m Source #

ifoldr :: (Either i j -> a -> b -> b) -> b -> (f :*: g) a -> b Source #

ifoldl :: (Either i j -> b -> a -> b) -> b -> (f :*: g) a -> b Source #

ifoldr' :: (Either i j -> a -> b -> b) -> b -> (f :*: g) a -> b Source #

ifoldl' :: (Either i j -> b -> a -> b) -> b -> (f :*: g) a -> b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (Either i j) (f :+: g) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => (Either i j -> a -> m) -> (f :+: g) a -> m Source #

ifoldMap' :: Monoid m => (Either i j -> a -> m) -> (f :+: g) a -> m Source #

ifoldr :: (Either i j -> a -> b -> b) -> b -> (f :+: g) a -> b Source #

ifoldl :: (Either i j -> b -> a -> b) -> b -> (f :+: g) a -> b Source #

ifoldr' :: (Either i j -> a -> b -> b) -> b -> (f :+: g) a -> b Source #

ifoldl' :: (Either i j -> b -> a -> b) -> b -> (f :+: g) a -> b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (i, j) (Compose f g) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => ((i, j) -> a -> m) -> Compose f g a -> m Source #

ifoldMap' :: Monoid m => ((i, j) -> a -> m) -> Compose f g a -> m Source #

ifoldr :: ((i, j) -> a -> b -> b) -> b -> Compose f g a -> b Source #

ifoldl :: ((i, j) -> b -> a -> b) -> b -> Compose f g a -> b Source #

ifoldr' :: ((i, j) -> a -> b -> b) -> b -> Compose f g a -> b Source #

ifoldl' :: ((i, j) -> b -> a -> b) -> b -> Compose f g a -> b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) => FoldableWithIndex (i, j) (f :.: g) |

Instance details

Defined in WithIndex

Methods

ifoldMap :: Monoid m => ((i, j) -> a -> m) -> (f :.: g) a -> m Source #

ifoldMap' :: Monoid m => ((i, j) -> a -> m) -> (f :.: g) a -> m Source #

ifoldr :: ((i, j) -> a -> b -> b) -> b -> (f :.: g) a -> b Source #

ifoldl :: ((i, j) -> b -> a -> b) -> b -> (f :.: g) a -> b Source #

ifoldr' :: ((i, j) -> a -> b -> b) -> b -> (f :.: g) a -> b Source #

ifoldl' :: ((i, j) -> b -> a -> b) -> b -> (f :.: g) a -> b Source #