TypeCompose-0.9.9: Type composition classes & instances

PortabilityTypeOperators
Stabilityexperimental
Maintainerconal@conal.net
Safe HaskellSafe-Inferred

Data.Bijection

Description

Bijections. For a more general setting, see also [1] There and Back Again: Arrows for Invertible Programming, http://citeseer.ist.psu.edu/alimarine05there.html.

Synopsis

Documentation

data Bijection j a b Source

A type of bijective arrows

Constructors

Bi 

Fields

biTo :: a `j` b
 
biFrom :: b `j` a
 

Instances

type :<->: a b = Bijection (->) a bSource

Bijective functions

idb :: Arrow j => Bijection j a aSource

Bijective identity arrow. Warning: uses arr on (~>). If you have no arr, but you have a DeepArrow, you can instead use Bi idA idA.

inverse :: Bijection j a b -> Bijection j b aSource

Inverse bijection

bimap :: Functor f => (a :<->: b) -> f a :<->: f bSource

Bijections on functors

(--->) :: Arrow j => Bijection j a b -> Bijection j c d -> (a `j` c) :<->: (b `j` d)Source

Bijections on arrows.

inBi :: Arrow j => Bijection j a b -> (a `j` a) -> b `j` bSource

Apply a function in an alternative (monomorphic) representation.