HORIZON HASKELLDocslts/ghc-9.14.x7a6c33e2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 7a6c33e · 2026-10-12

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, …