Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data A_Prism :: OpticKind
- type Prism s t a b = Optic A_Prism '[] s t a b
- type Prism' s a = Optic' A_Prism '[] s a
- toPrism :: Is k A_Prism => Optic k is s t a b -> Optic A_Prism is s t a b
- prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
- prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b
- withPrism :: Is k A_Prism => Optic k is s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r
- aside :: Is k A_Prism => Optic k '[] s t a b -> Prism (e, s) (e, t) (e, a) (e, b)
- without :: (Is k A_Prism, Is l A_Prism) => Optic k '[] s t a b -> Optic l '[] u v c d -> Prism (Either s u) (Either t v) (Either a c) (Either b d)
- below :: (Is k A_Prism, Traversable f) => Optic' k '[] s a -> Prism' (f s) (f a)
- isn't :: Is k A_Prism => Optic k is s t a b -> s -> Bool
- matching :: Is k A_Prism => Optic k is s t a b -> s -> Either t a
- module Optics.Optic
Documentation
Tag for a prism.
Instances
toPrism :: Is k A_Prism => Optic k is s t a b -> Optic A_Prism is s t a b #
Explicitly cast an optic to a prism.
prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b #
Build a prism from a constructor and a matcher.
aside :: Is k A_Prism => Optic k '[] s t a b -> Prism (e, s) (e, t) (e, a) (e, b) #
Use a Prism
to work over part of a structure.
without :: (Is k A_Prism, Is l A_Prism) => Optic k '[] s t a b -> Optic l '[] u v c d -> Prism (Either s u) (Either t v) (Either a c) (Either b d) #
Given a pair of prisms, project sums.
below :: (Is k A_Prism, Traversable f) => Optic' k '[] s a -> Prism' (f s) (f a) #
lift
a Prism
through a Traversable
functor, giving a Prism that
matches only if all the elements of the container match the Prism
.
matching :: Is k A_Prism => Optic k is s t a b -> s -> Either t a #
Retrieve the value targeted by a Prism
or return the original value while
allowing the type to change if it does not match.
module Optics.Optic