HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleoptics-core-0.4.2Haskell2010

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