HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleoptics-core-0.4.1.1Haskell2010

Optics.ReversedPrism

A ReversedPrism is a backwards Prism, i.e. a ReversedPrism s t a b is equivalent to a Prism b a t s. These are typically produced by calling re on a Prism. They are distinguished from a Getter so that re . re on a Prism returns a Prism.

  • 3 types

Formation

2 declarations

Introduction

0 declarations

There is no canonical introduction form for ReversedPrism, but you can use re to construct one from a Prism:

(\ f g -> re (prism f g)) :: (s -> a) -> (b -> Either a t) -> ReversedPrism s t a b

Elimination

0 declarations

A ReversedPrism is a Getter, so you can specialise types to obtain:

view :: ReversedPrism' s a -> s -> a

There is no reversed matching defined, but it is definable using re:

matching . re :: ReversedPrism s t a b -> b -> Either a t

Computation

0 declarations
view          $ re (prism f g) ≡ f
matching . re $ re (prism f g) ≡ g

Subtyping

1 declaration
datadata A_ReversedPrism
#

Tag for a reversed prism.

Instances27ReversibleOptic, Is, JoinKinds, ToReadOnly, MappingOptic, MappedOptic, …