HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleoptics-core-0.4.1.1Haskell2010

Optics.ReversedLens

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.

  • 3 types

Formation

2 declarations

Introduction

0 declarations

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

0 declarations

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

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

Subtyping

1 declaration
datadata A_ReversedLens
#

Tag for a reversed lens.

Instances13ReversibleOptic, Is, JoinKinds, MappingOptic, MappedOptic, ReversedOptic, …