Idris2Doc : Monocle.Fold

Monocle.Fold

(source)

Definitions

record Fold : Type -> Type -> Type -> Type -> Type
  A Fold is a composable data accessor, allowing us to extract
zero or more values of type `a` from a value of type `s`.

Like other optics, `Folds` can be composed sequentially via operator
`(~>)`.

This is a type constructor parameterized over four type parameters
of which two (`t` and `b`) are phantom types without any runtime
relevance. We need them in order to compose Folds with other
optics (see module `Monocle.Compose`).

Folds are mainly useful because almost all other optics can be
converted to Folds (with the exception of `Setter`s).

Totality: total
Visibility: public export
Constructor: 
F : (Monoid m => (a -> m) -> s -> m) -> Fold s t a b

Projection: 
.foldMap_ : Fold s t a b -> Monoid m => (a -> m) -> s -> m

Hints:
OSeq Iso Fold Fold
OSeq Lens Fold Fold
OSeq Prism Getter Fold
OSeq Prism Fold Fold
OSeq Optional Getter Fold
OSeq Optional Fold Fold
OSeq Traversal Getter Fold
OSeq Traversal Fold Fold
OSeq Getter Prism Fold
OSeq Getter Optional Fold
OSeq Getter Traversal Fold
OSeq Getter Fold Fold
OSeq Fold Fold Fold
OSeq Fold Iso Fold
OSeq Fold Lens Fold
OSeq Fold Prism Fold
OSeq Fold Optional Fold
OSeq Fold Traversal Fold
OSeq Fold Getter Fold
ToFold Fold
.foldMap_ : Fold s t a b -> Monoid m => (a -> m) -> s -> m
Totality: total
Visibility: public export
foldMap_ : Fold s t a b -> Monoid m => (a -> m) -> s -> m
Totality: total
Visibility: public export
fold_ : Foldable t => Fold (t a) (t a) a a
  We can fold over every `Foldable`.

Totality: total
Visibility: public export
empty : Fold s t a b
  The empty Fold, which always yields zero values.

Totality: total
Visibility: public export
(~>) : Fold s t a b -> Fold a b c d -> Fold s t c d
  Sequential composition of Folds.

Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 0
interface ToFold : (Type -> Type -> Type -> Type -> Type) -> Type
  Interface for converting other optics to Folds.

Parameters: o
Methods:
toFold : o s t a b -> Fold s t a b

Implementations:
ToFold Iso
ToFold Getter
ToFold Lens
ToFold Optional
ToFold Prism
ToFold Fold
ToFold Traversal
toFold : ToFold o => o s t a b -> Fold s t a b
Totality: total
Visibility: public export
foldMap : Monoid m => ToFold o => o s t a b -> (a -> m) -> s -> m
  Use a Fold to extract data from a source value and accumulate it
via a `Monoid`.

Totality: total
Visibility: public export
fold : ToFold o => Monoid a => o s t a b -> s -> a
  Use a Fold to extract and accumulate data with a `Monoid` implementation
from a source value.

Totality: total
Visibility: public export
asList : ToFold o => o s t a b -> s -> List a
  Use a Fold to extract data from a source value and store it in a `List`.

Totality: total
Visibility: public export
asSnocList : ToFold o => o s t a b -> s -> SnocList a
  Use a Fold to extract data from a source value and
store it in a `SnocList`.

Totality: total
Visibility: public export
first : ToFold o => o s t a b -> s -> Maybe a
  Use a Fold to try and extract the first piece of data from a source value.

Totality: total
Visibility: public export
last : ToFold o => o s t a b -> s -> Maybe a
  Use a Fold to try and extract the last piece of data from a source value.

Totality: total
Visibility: public export
find : ToFold o => o s t a b -> (a -> Bool) -> s -> Maybe a
  Use a Fold to try and extract the first piece of data
fulfilling a predicate from a source value.

Totality: total
Visibility: public export