roundtrip-0.2.0.7: Bidirectional (de-)serialization

Safe HaskellSafe
LanguageHaskell2010

Control.Isomorphism.Partial.Prim

Contents

Synopsis

Documentation

idIso :: Iso a a Source #

inverse :: Iso alpha beta -> Iso beta alpha Source #

apply :: Iso alpha beta -> alpha -> Maybe beta Source #

unapply :: Iso alpha beta -> beta -> Maybe alpha Source #

class IsoFunctor f where Source #

Methods

(<$>) :: Iso alpha beta -> f alpha -> f beta infix 5 Source #

Instances
IsoFunctor SpecPrinter Source # 
Instance details

Defined in Text.Roundtrip.SpecPrinter

Methods

(<$>) :: Iso alpha beta -> SpecPrinter alpha -> SpecPrinter beta Source #

ignore :: alpha -> Iso alpha () Source #

(***) :: Iso alpha beta -> Iso gamma delta -> Iso (alpha, gamma) (beta, delta) Source #

the product type constructor `(,)` is a bifunctor from Iso $times$ Iso to Iso, so that we have the bifunctorial map *** which allows two separate isomorphisms to work on the two components of a tuple.

(|||) :: Iso alpha gamma -> Iso beta gamma -> Iso (Either alpha beta) gamma Source #

The mediating arrow for sums constructed with Either. This is not a proper partial isomorphism because of mplus.

associate :: Iso (alpha, (beta, gamma)) ((alpha, beta), gamma) Source #

Nested products associate.

commute :: Iso (alpha, beta) (beta, alpha) Source #

Products commute.

unit :: Iso alpha (alpha, ()) Source #

`()` is the unit element for products.

element :: (Show alpha, Eq alpha) => alpha -> Iso () alpha Source #

`element x` is the partial isomorphism between `()` and the singleton set which contains just x.

subset :: Show alpha => (alpha -> Bool) -> Iso alpha alpha Source #

For a predicate p, `subset p` is the identity isomorphism restricted to elements matching the predicate.

namedSubset :: Show alpha => String -> (alpha -> Bool) -> Iso alpha alpha Source #

iterateIso :: Iso alpha alpha -> Iso alpha alpha Source #

distribute :: Iso (alpha, Either beta gamma) (Either (alpha, beta) (alpha, gamma)) Source #

Products distribute over sums.

listMapIso :: Ord a => Iso [(a, b)] (Map a b) Source #

Orphan instances

Category Iso Source # 
Instance details

Methods

id :: Iso a a #

(.) :: Iso b c -> Iso a b -> Iso a c #