Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data A_Fold :: OpticKind
- type Fold s a = Optic' A_Fold '[] s a
- toFold :: Is k A_Fold => Optic' k is s a -> Optic' A_Fold is s a
- class ViewableOptic k r where
- type ViewResult k r :: *
- viewM :: (ViewableOptic k r, MonadReader s m) => Optic' k is s r -> m (ViewResult k r)
- viewN :: (Is k A_Fold, Monoid a) => Optic' k is s a -> s -> a
- preview :: Is k A_Fold => Optic' k is s a -> s -> Maybe a
- foldMapOf :: (Monoid r, Is k A_Fold) => Optic' k is s a -> (a -> r) -> s -> r
- foldrOf :: Is k A_Fold => Optic' k is s a -> (a -> r -> r) -> r -> s -> r
- foldlOf' :: Is k A_Fold => Optic' k is s a -> (r -> a -> r) -> r -> s -> r
- toListOf :: Is k A_Fold => Optic' k is s a -> s -> [a]
- 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
- folding :: Foldable f => (s -> f a) -> Fold s a
- 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
- module Optics.Optic
Documentation
Tag for a fold.
Instances
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 #
type ViewResult k r :: * #
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
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.
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 () #
Concrete folds
concatMapOf :: Is k A_Fold => Optic' k is s a -> (a -> [b]) -> s -> [b] #
module Optics.Optic