partial-isomorphisms-0.2.3.0: Partial isomorphisms.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Isomorphism.Partial.Prim

Synopsis

Documentation

data Iso alpha beta Source #

Instances

Instances details
Category Iso 
Instance details

Defined in Control.Isomorphism.Partial.Prim

Methods

id :: forall (a :: k). Iso a a

(.) :: forall (b :: k) (c :: k) (a :: k). Iso b c -> Iso a b -> Iso a c

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 #

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 :: Eq alpha => alpha -> Iso () alpha Source #

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

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

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

iterate :: Iso alpha alpha -> Iso alpha alpha Source #

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

Products distribute over sums.

Orphan instances

Category Iso Source # 
Instance details

Methods

id :: forall (a :: k). Iso a a

(.) :: forall (b :: k) (c :: k) (a :: k). Iso b c -> Iso a b -> Iso a c