Module

Data.Lens.Iso

Package
purescript-profunctor-lenses
Repository
purescript-contrib/purescript-profunctor-lenses

This module defines functions for working with isomorphisms.

#iso Source

iso :: forall s t a b. (s -> a) -> (b -> t) -> Iso s t a b

Create an Iso from a pair of morphisms.

#withIso Source

withIso :: forall s t a b r. AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r

Extracts the pair of morphisms from an isomorphism.

#cloneIso Source

cloneIso :: forall s t a b. AnIso s t a b -> Iso s t a b

Extracts an Iso from AnIso.

#re Source

re :: forall p s t a b. Optic (Re p a b) s t a b -> Optic p b a t s

Reverses an optic.

#au Source

au :: forall s t a b e. AnIso s t a b -> ((b -> t) -> e -> s) -> e -> a

#auf Source

auf :: forall s t a b e r p. Profunctor p => AnIso s t a b -> (p r a -> e -> b) -> p r s -> e -> t

#under Source

under :: forall s t a b. AnIso s t a b -> (t -> s) -> b -> a

#non Source

non :: forall a. Eq a => a -> Iso' (Maybe a) a

If a1 is obtained from a by removing a single value, then Maybe a1 is isomorphic to a.

#curried Source

curried :: forall a b c d e f. Iso (Tuple a b -> c) (Tuple d e -> f) (a -> b -> c) (d -> e -> f)

#uncurried Source

uncurried :: forall a b c d e f. Iso (a -> b -> c) (d -> e -> f) (Tuple a b -> c) (Tuple d e -> f)

#flipped Source

flipped :: forall a b c d e f. Iso (a -> b -> c) (d -> e -> f) (b -> a -> c) (e -> d -> f)

#mapping Source

mapping :: forall s t a b f g. Functor f => Functor g => AnIso s t a b -> Iso (f s) (g t) (f a) (g b)

#dimapping Source

dimapping :: forall s ss t tt a aa b bb p q. Profunctor p => Profunctor q => AnIso s t a b -> AnIso ss tt aa bb -> Iso (p a ss) (q b tt) (p s aa) (q t bb)

Re-exports from Data.Lens.Types

#Re Source

newtype Re p s t a b

Constructors

  • Re (p b a -> p t s)

Instances

#Optic Source

type Optic p s t a b = p a b -> p s t

#Iso' Source

type Iso' s a = Iso s s a a

#Iso Source

type Iso s t a b = forall p. Profunctor p => Optic p s t a b

A generalized isomorphism.

#Exchange Source

data Exchange a b s t

The Exchange profunctor characterizes an Iso.

Constructors

Instances

#AnIso' Source

type AnIso' s a = AnIso s s a a

#AnIso Source

type AnIso s t a b = Optic (Exchange a b) s t a b