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.Re

Some optics can be reversed with re. This is mainly useful to invert Isos:

Example2 expressions
let _Identity = iso runIdentity Identityview (_1 % re _Identity) ('x', "yz")Identity 'x'

Yet we can use a Lens as a Review too:

Example1 expression
review (re _1) ('x', "yz")'x'

In the following diagram, red arrows illustrate how re transforms optics. The ReversedLens and ReversedPrism optic kinds are backwards versions of Lens and Prism respectively, and are present so that re . re does not change the optic kind.

Reversed Optics

  • 1 class
classclass ReversibleOptic (k :: OpticKind) where
#

Class for optics that can be reversed.

Methods

Instances7ReversibleOptic, …