TypeCompose-0.9.11: Type composition classes & instances

Copyright(c) Conal Elliott 2007
LicenseBSD3
Maintainerconal@conal.net
Stabilityexperimental
PortabilityTypeOperators
Safe HaskellSafe
LanguageHaskell98

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 b infix 8 Source

Bijective functions

idb :: Arrow j => Bijection j a a Source

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 a Source

Inverse bijection

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

Bijections on functors

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

Bijections on arrows.

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

Apply a function in an alternative (monomorphic) representation.