optics-core-0.1

Safe HaskellNone
LanguageHaskell2010

Optics.Fold

Contents

Synopsis

Documentation

data A_Fold :: OpticKind #

Tag for a fold.

Instances
UnindexableOptic A_Fold # 
Instance details

Defined in Optics.Unindexed

Methods

unIx :: CheckIndices i is => Optic A_Fold is s t a b -> Optic A_Fold [] s t a b #

Is An_AffineFold A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy An_AffineFold A_Fold p -> (Constraints An_AffineFold p -> r) -> Constraints A_Fold p -> r

Is A_Getter A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy A_Getter A_Fold p -> (Constraints A_Getter p -> r) -> Constraints A_Fold p -> r

Is A_PrismaticGetter A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy A_PrismaticGetter A_Fold p -> (Constraints A_PrismaticGetter p -> r) -> Constraints A_Fold p -> r

Is A_Traversal A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy A_Traversal A_Fold p -> (Constraints A_Traversal p -> r) -> Constraints A_Fold p -> r

Is An_AffineTraversal A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy An_AffineTraversal A_Fold p -> (Constraints An_AffineTraversal p -> r) -> Constraints A_Fold p -> r

Is A_Prism A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy A_Prism A_Fold p -> (Constraints A_Prism p -> r) -> Constraints A_Fold p -> r

Is A_Lens A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy A_Lens A_Fold p -> (Constraints A_Lens p -> r) -> Constraints A_Fold p -> r

Is An_Iso A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy An_Iso A_Fold p -> (Constraints An_Iso p -> r) -> Constraints A_Fold p -> r

Is An_Equality A_Fold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy An_Equality A_Fold p -> (Constraints An_Equality p -> r) -> Constraints A_Fold p -> r

Monoid r => ViewableOptic A_Fold r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_Fold r :: * #

Methods

view :: Optic' A_Fold is s r -> s -> ViewResult A_Fold r #

type ViewResult A_Fold r # 
Instance details

Defined in Optics.Internal.View

type ViewResult A_Fold r = r

type Fold s a = Optic' A_Fold '[] s a #

Type synonym for a fold.

toFold :: Is k A_Fold => Optic' k is s a -> Optic' A_Fold is s a #

Explicitly cast an optic to a fold.

class ViewableOptic k r where #

Minimal complete definition

view

Associated Types

type ViewResult k r :: * #

Methods

view :: Optic' k is s r -> s -> ViewResult k r #

Apply an optic to view its result. Isos, Lenses, PrismaticGetters and Getters return exactly one, Prisms, AffineTraversals and AffineFolds return at most one, whereas Folds and Traversals return a sum (with respect to a Monoid instance) of all their results.

Instances
Monoid r => ViewableOptic A_Fold r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_Fold r :: * #

Methods

view :: Optic' A_Fold is s r -> s -> ViewResult A_Fold r #

ViewableOptic An_AffineFold r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult An_AffineFold r :: * #

Methods

view :: Optic' An_AffineFold is s r -> s -> ViewResult An_AffineFold r #

ViewableOptic A_Getter r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_Getter r :: * #

Methods

view :: Optic' A_Getter is s r -> s -> ViewResult A_Getter r #

ViewableOptic A_PrismaticGetter r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_PrismaticGetter r :: * #

Monoid r => ViewableOptic A_Traversal r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_Traversal r :: * #

Methods

view :: Optic' A_Traversal is s r -> s -> ViewResult A_Traversal r #

ViewableOptic An_AffineTraversal r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult An_AffineTraversal r :: * #

ViewableOptic A_Prism r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_Prism r :: * #

Methods

view :: Optic' A_Prism is s r -> s -> ViewResult A_Prism r #

ViewableOptic A_Lens r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult A_Lens r :: * #

Methods

view :: Optic' A_Lens is s r -> s -> ViewResult A_Lens r #

ViewableOptic An_Iso r # 
Instance details

Defined in Optics.Internal.View

Associated Types

type ViewResult An_Iso r :: * #

Methods

view :: Optic' An_Iso is s r -> s -> ViewResult An_Iso r #

viewM :: (ViewableOptic k r, MonadReader s m) => Optic' k is s r -> m (ViewResult k r) #

Generalization of view from (->) s to arbitrary MonadReader s m.

viewN :: (Is k A_Fold, Monoid a) => Optic' k is s a -> s -> a #

View the result of folding over all the results of a Fold or Traversal that points at a monoidal value.

preview :: Is k A_Fold => Optic' k is s a -> s -> Maybe a #

Fold to the first element (if it exists).

foldMapOf :: (Monoid r, Is k A_Fold) => Optic' k is s a -> (a -> r) -> s -> r #

Fold via embedding into a monoid.

foldrOf :: Is k A_Fold => Optic' k is s a -> (a -> r -> r) -> r -> s -> r #

Fold right-associatively.

foldlOf' :: Is k A_Fold => Optic' k is s a -> (r -> a -> r) -> r -> s -> r #

Fold left-associatively, and strictly.

toListOf :: Is k A_Fold => Optic' k is s a -> s -> [a] #

Fold to a list.

sequenceOf_ :: (Is k A_Fold, Applicative f) => Optic' k is s (f a) -> s -> f () #

traverseOf_ :: (Is k A_Fold, Applicative f) => Optic' k is s a -> (a -> f r) -> s -> f () #

folded :: Foldable f => Fold (f a) a #

Fold via the Foldable class.

folding :: Foldable f => (s -> f a) -> Fold s a #

Concrete folds

andOf :: Is k A_Fold => Optic' k is s Bool -> s -> Bool #

orOf :: Is k A_Fold => Optic' k is s Bool -> s -> Bool #

allOf :: Is k A_Fold => Optic' k is s a -> (a -> Bool) -> s -> Bool #

anyOf :: Is k A_Fold => Optic' k is s a -> (a -> Bool) -> s -> Bool #

noneOf :: Is k A_Fold => Optic' k is s a -> (a -> Bool) -> s -> Bool #

productOf :: (Is k A_Fold, Num a) => Optic' k is s a -> s -> a #

sumOf :: (Is k A_Fold, Num a) => Optic' k is s a -> s -> a #

asumOf :: (Is k A_Fold, Alternative f) => Optic' k is s (f a) -> s -> f a #

msumOf :: (Is k A_Fold, MonadPlus m) => Optic' k is s (m a) -> s -> m a #

elemOf :: (Is k A_Fold, Eq a) => Optic' k is s a -> a -> s -> Bool #

notElemOf :: (Is k A_Fold, Eq a) => Optic' k is s a -> a -> s -> Bool #

concatOf :: Is k A_Fold => Optic' k is s [a] -> s -> [a] #

concatMapOf :: Is k A_Fold => Optic' k is s a -> (a -> [b]) -> s -> [b] #

lengthOf :: Is k A_Fold => Optic' k is s a -> s -> Int #