split-morphism-0.1.0.0: Split Epimorphisms and Monomorphisms

Safe HaskellNone
LanguageHaskell2010

Control.Lens.Format

Synopsis

Documentation

data Format a b Source #

A normalizing optic, isomorphic to Prism but with different laws, specifically getMaybe needs not to be injective; i.e., distinct inputs may have the same getMaybe result, which combined with a subsequent reverseGet yields a normalized form for a. Composition with stronger optics (Prism and Iso) yields another Format.

Constructors

Format 

Fields

Instances
Invariant (Format a) Source # 
Instance details

Defined in Control.Lens.Format

Methods

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

normalize :: Format a b -> a -> Maybe a Source #

getMaybe and reverseGet, yielding a normalized formatted value. Subsequent getMaybe/reverseGet cycles are idempotent.

composePrism :: Format a b -> Prism' b c -> Format a c Source #

Compose with a Prism.

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

Compose with an Iso.

fromPrism :: Prism' a b -> Format a b Source #

A Prism is trivially a Format.

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

An Isomorphism is trivially a Format.