optics-core-0.4.1: Optics as an abstract interface: core definitions
Safe Haskell None
Language Haskell2010

Optics.ReversedPrism

Description

A ReversedPrism is a backwards Prism , i.e. a ReversedPrism s t a b is equivalent to a Prism b a t s . These are typically produced by calling re on a Prism . They are distinguished from a Getter so that re . re on a Prism returns a Prism .

Synopsis

Formation

type ReversedPrism s t a b = Optic A_ReversedPrism NoIx s t a b Source #

Type synonym for a type-modifying reversed prism.

type ReversedPrism' s a = Optic' A_ReversedPrism NoIx s a Source #

Type synonym for a type-preserving reversed prism.

Introduction

There is no canonical introduction form for ReversedPrism , but you can use re to construct one from a Prism :

(\ f g -> re (prism f g)) :: (s -> a) -> (b -> Either a t) -> ReversedPrism s t a b

Elimination

A ReversedPrism is a Getter , so you can specialise types to obtain:

view :: ReversedPrism' s a -> s -> a

There is no reversed matching defined, but it is definable using re :

matching . re :: ReversedPrism s t a b -> b -> Either a t

Computation

view          $ re (prism f g) ≡ f
matching . re $ re (prism f g) ≡ g

Subtyping

data A_ReversedPrism :: OpticKind Source #

Tag for a reversed prism.

Instances

Instances details
ReversibleOptic A_ReversedPrism Source #
Instance details

Defined in Optics.Re

Is A_ReversedPrism A_Fold Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

Is A_ReversedPrism An_AffineFold Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

Is A_ReversedPrism A_Getter Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

Is An_Iso A_ReversedPrism Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Fold => JoinKinds A_Fold A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ An_AffineFold => JoinKinds An_AffineFold A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Getter => JoinKinds A_Getter A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Fold => JoinKinds A_ReversedPrism A_Fold k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ An_AffineFold => JoinKinds A_ReversedPrism An_AffineFold k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Getter => JoinKinds A_ReversedPrism A_Getter k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_ReversedPrism => JoinKinds A_ReversedPrism A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Fold => JoinKinds A_ReversedPrism A_Traversal k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ An_AffineFold => JoinKinds A_ReversedPrism An_AffineTraversal k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ An_AffineFold => JoinKinds A_ReversedPrism A_Prism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Getter => JoinKinds A_ReversedPrism A_Lens k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_ReversedPrism => JoinKinds A_ReversedPrism An_Iso k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Fold => JoinKinds A_Traversal A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ An_AffineFold => JoinKinds An_AffineTraversal A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ An_AffineFold => JoinKinds A_Prism A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Getter => JoinKinds A_Lens A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_ReversedPrism => JoinKinds An_Iso A_ReversedPrism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

ToReadOnly A_ReversedPrism s t a b Source #
Instance details

Defined in Optics.ReadOnly

( Functor f, f ~ g, s ~ t, a ~ b) => MappingOptic A_ReversedPrism f g s t a b Source #
Instance details

Defined in Optics.Mapping

Methods

mapping :: forall (is :: IxList ). AcceptsEmptyIndices "mapping" is => Optic A_ReversedPrism is s t a b -> Optic ( MappedOptic A_ReversedPrism ) is (f s) (g t) (f a) (g b) Source #

type ReversedOptic A_ReversedPrism Source #
Instance details

Defined in Optics.Re

type ReadOnlyOptic A_ReversedPrism Source #
Instance details

Defined in Optics.ReadOnly

type MappedOptic A_ReversedPrism Source #
Instance details

Defined in Optics.Mapping