optics-core-0.4.1: Optics as an abstract interface: core definitions
Safe HaskellNone
LanguageHaskell2010

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

Associated Types

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

Methods

re :: forall (is :: IxList) s t a b. AcceptsEmptyIndices "re" is => Optic A_ReversedLens is s t a b -> Optic (ReversedOptic A_ReversedLens) is b a t s Source #

Is A_ReversedLens A_Review Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints A_ReversedLens p => r) -> Constraints A_Review p => r Source #

Is An_Iso A_ReversedLens Source # 
Instance details

Defined in Optics.Internal.Optic.Subtyping

Methods

implies :: forall (p :: Type -> Type -> Type -> Type) r. (Constraints An_Iso p => r) -> Constraints A_ReversedLens p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Review p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints A_Review p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints A_Prism p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_ReversedLens p, Constraints An_Iso p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints A_Prism p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Internal.Optic.Subtyping

Methods

joinKinds :: forall (p :: Type -> Type -> Type -> Type) r. ((Constraints An_Iso p, Constraints A_ReversedLens p) => r) -> Constraints k p => r Source #

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

Defined in Optics.Mapping

Associated Types

type MappedOptic A_ReversedLens Source #

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