TypeCompose-0.5: Type composition classes & instancesSource codeContentsIndex
Data.Bijection
PortabilityTypeOperators
Stabilityexperimental
Maintainerconal@conal.net
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
data Bijection (~>) a b = Bi {
biTo :: a ~> b
biFrom :: b ~> a
}
type :<->: a b = Bijection (->) a b
idb :: Arrow ~> => Bijection ~> a a
inverse :: Bijection ~> a b -> Bijection ~> b a
bimap :: Functor f => (a :<->: b) -> f a :<->: f b
(--->) :: Arrow ~> => Bijection ~> a b -> Bijection ~> c d -> (a ~> c) :<->: (b ~> d)
inBi :: Arrow ~> => Bijection ~> a b -> (a ~> a) -> b ~> b
Documentation
data Bijection (~>) a b Source
A type of bijective arrows
Constructors
Bi
biTo :: a ~> b
biFrom :: b ~> a
show/hide Instances
Arrow ~> => Arrow (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.
Produced by Haddock version 2.3.0