HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleoptics-core-0.4.2Haskell2010

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.

Contents
  1. Formation
  2. Introduction
  3. Elimination
  4. Computation
  5. Subtyping
Synopsis
  • Packageoptics-core-0.4.2
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceReversedLens.hs

Formation

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

datadata A_ReversedLens

Tag for a reversed lens.

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