optics-core-0.3.0.1: Optics as an abstract interface: core definitions

Safe HaskellNone
LanguageHaskell2010

Optics.ReversedPrism

Contents

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
ReversibleOptic A_ReversedPrism Source # 
Instance details

Defined in Optics.Re

Associated Types

type ReversedOptic A_ReversedPrism = (r :: Type) Source #

Methods

re :: AcceptsEmptyIndices "re" is => Optic A_ReversedPrism is s t a b -> Optic (ReversedOptic A_ReversedPrism) is b a t s Source #

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

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

Associated Types

type MappedOptic A_ReversedPrism :: Type Source #

Methods

mapping :: 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 MappedOptic A_ReversedPrism Source # 
Instance details

Defined in Optics.Mapping