TypeCompose-0.6.2: Type composition classes & instances

PortabilityTypeOperators
Stabilityexperimental
Maintainerconal@conal.net

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 (~>) a b Source

A type of bijective arrows

Constructors

Bi 

Fields

biTo :: a ~> b
 
biFrom :: b ~> a
 

Instances

Arrow ~> => Arrow (Bijection ~>) 
Category ~> => Category (Bijection ~>) 

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

Bijective functions

idb :: Arrow ~> => Bijection ~> 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 ~> a b -> Bijection ~> b aSource

Inverse bijection

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

Bijections on functors

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

Bijections on arrows.

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

Apply a function in an alternative (monomorphic) representation.