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

Optics.ReversedLens

Description

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

Synopsis

Formation

type ReversedLens s t a b = Optic A_ReversedLens NoIx s t a b Source #

Type synonym for a type-modifying reversed lens.

type ReversedLens' t b = Optic' A_ReversedLens NoIx t b Source #

Type synonym for a type-preserving reversed lens.

Introduction

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

(\ f g -> re (lens f g)) :: (b -> t) -> (b -> s -> a) -> ReversedLens s t a b

Elimination

A ReversedLens is a Review , so you can specialise types to obtain:

review :: ReversedLens' s a -> a -> s

There is no corresponding optic kind for a backwards Setter , but a reversed set is definable using re :

set . re :: ReversedLens s t a b -> s -> b -> a

Computation

review   $ re (lens f g) ≡ f
set . re $ re (lens f g) ≡ g

Subtyping

data A_ReversedLens :: OpticKind Source #

Tag for a reversed lens.

Instances

Instances details
ReversibleOptic A_ReversedLens Source #
Instance details

Defined in Optics.Re

Is A_ReversedLens A_Review Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

Is An_Iso A_ReversedLens Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Review => JoinKinds A_Review A_ReversedLens k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Review => JoinKinds A_ReversedLens A_Review k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

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

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Review => JoinKinds A_ReversedLens A_Prism k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

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

Defined in Optics.Internal.Optic.Subtyping

k ~ A_Review => JoinKinds A_Prism A_ReversedLens k Source #
Instance details

Defined in Optics.Internal.Optic.Subtyping

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

Defined in Optics.Internal.Optic.Subtyping

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

Defined in Optics.Mapping

Methods

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

type ReversedOptic A_ReversedLens Source #
Instance details

Defined in Optics.Re

type MappedOptic A_ReversedLens Source #
Instance details

Defined in Optics.Mapping