lens-4.0.1: Lenses, Folds and Traversals

PortabilityRank2Types
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Control.Lens.Equality

Contents

Description

 

Synopsis

Type Equality

type Equality s t a b = forall p f. p a (f b) -> p s (f t)Source

A witness that (a ~ s, b ~ t).

Note: Composition with an Equality is index-preserving.

type Equality' s a = Equality s s a aSource

type AnEquality s t a b = Identical a (Identity b) a (Identity b) -> Identical a (Identity b) s (Identity t)Source

When you see this as an argument to a function, it expects an Equality.

runEq :: AnEquality s t a b -> Identical s t a bSource

Extract a witness of type Equality.

substEq :: AnEquality s t a b -> ((s ~ a, t ~ b) => r) -> rSource

Substituting types with Equality.

mapEq :: AnEquality s t a b -> f s -> f aSource

We can use Equality to do substitution into anything.

fromEq :: AnEquality s t a b -> Equality b a t sSource

Equality is symmetric.

simply :: (Optic' p f s a -> r) -> Optic' p f s a -> rSource

This is an adverb that can be used to modify many other Lens combinators to make them require simple lenses, simple traversals, simple prisms or simple isos as input.

Implementation Details

data Identical a b s t whereSource

Provides witness that (s ~ a, b ~ t) holds.

Constructors

Identical :: Identical a b a b