split-morphism-0.1.0.0: Split Epimorphisms and Monomorphisms

Safe HaskellNone
LanguageHaskell2010

Control.Lens.SplitMono

Synopsis

Documentation

data SplitMono a b Source #

A split monomorphism, which we can think of as a weaker Iso a b where a is a "smaller" type. So `reverseGet . get` remains an identity but `get . reverseGet` is merely idempotent (i.e., it normalizes values in b).

The following statements hold: - reverseGet is a "retraction" of get, - get is a "section" of reverseGet, - a is a "retract" of b, - the pair `(reverseGet, get)` is a "splitting" of the idempotent `get . reverseGet`.

Constructors

SplitMono 

Fields

Instances
Invariant (SplitMono a) Source # 
Instance details

Defined in Control.Lens.SplitMono

Methods

invmap :: (a0 -> b) -> (b -> a0) -> SplitMono a a0 -> SplitMono a b #

normalize :: SplitMono a b -> b -> b Source #

`reverseGet . get`, yielding a normalized formatted value. Subsequent get/reverseGet cycles are idempotent.

composeSplitMono :: SplitMono a b -> SplitMono b c -> SplitMono a c Source #

Compose with another SplitMono.

composeIso :: SplitMono a b -> Iso' b c -> SplitMono a c Source #

Compose with an Iso.

fromIso :: Iso' a b -> SplitMono a b Source #

An Isomorphism is trivially a SplitMono.