optics-core-0.1

Safe HaskellNone
LanguageHaskell2010

Optics.Prism

Synopsis

Documentation

data A_Prism :: OpticKind #

Tag for a prism.

Instances
ReversibleOptic A_Prism # 
Instance details

Defined in Optics.Internal.Re

Associated Types

type ReversedOptic A_Prism :: OpticKind #

Methods

re :: Optic A_Prism [] s t a b -> Optic (ReversedOptic A_Prism) [] b a t s #

Is A_Prism A_Review # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: proxy A_Prism A_Review p -> (Constraints A_Prism p -> r) -> Constraints A_Review 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_Prism An_AffineFold # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

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

Is A_Prism A_Setter # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

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

Is A_Prism A_Traversal # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

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

Is A_Prism An_AffineTraversal # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

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

Is An_Iso A_Prism # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

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

Is An_Equality A_Prism # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

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

ArrowChoice arr => ArrowOptic A_Prism arr # 
Instance details

Defined in Optics.Arrow

Methods

overA :: Optic A_Prism [] s t a b -> arr a b -> arr s t #

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 #

PermeableOptic A_Prism r # 
Instance details

Defined in Optics.Internal.Passthrough

Methods

passthrough :: Optic A_Prism is s t a b -> (a -> (r, b)) -> s -> (ViewResult A_Prism r, t) #

type ReversedOptic A_Prism # 
Instance details

Defined in Optics.Internal.Re

type ViewResult A_Prism r # 
Instance details

Defined in Optics.Internal.View

type Prism s t a b = Optic A_Prism '[] s t a b #

Type synonym for a type-modifying prism.

type Prism' s a = Optic' A_Prism '[] s a #

Type synonym for a type-preserving prism.

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.

prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b #

This is usually used to build a Prism', when you have to use an operation like cast which already returns a Maybe.

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) #

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.

isn't :: Is k A_Prism => Optic k is s t a b -> s -> Bool #

Check to see if this Prism doesn't match.

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.