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

Synopsis
classclass ReversibleOptic (k :: OpticKind) where

Class for optics that can be reversed.

Methods

Instances7ReversibleOptic, …