invertible-0.2.0.7: bidirectional arrows, bijective functions, and invariant functors

Data.Invertible.Bijection

Description

The base representation for bidirectional arrows (bijections).

Synopsis

# Documentation

data Bijection (a :: * -> * -> *) b c Source #

A representation of a bidirectional arrow (embedding-projection pair of arrows transformer): an arrow and its inverse. Most uses will prefer the specialized <-> type for function arrows.

To constitute a valid bijection, biTo and biFrom should be inverses:

• biTo . biFrom = id
• biFrom . biTo = id

It may be argued that the arguments should be in the opposite order due to the arrow syntax, but it makes more sense to me to have the forward function come first.

Constructors

 (:<->:) infix 2 FieldsbiTo :: a b c biFrom :: a c b
Instances
 Arrow a => Arrow (Bijection a) Source # In order to use all the Arrow functions, we make a partially broken instance, where arr creates a bijection with a broken biFrom. See note on BiArrow'. &&& is first-biased, and uses only the left argument's biFrom. Instance detailsDefined in Data.Invertible.Bijection Methodsarr :: (b -> c) -> Bijection a b c #first :: Bijection a b c -> Bijection a (b, d) (c, d) #second :: Bijection a b c -> Bijection a (d, b) (d, c) #(***) :: Bijection a b c -> Bijection a b' c' -> Bijection a (b, b') (c, c') #(&&&) :: Bijection a b c -> Bijection a b c' -> Bijection a b (c, c') # ArrowZero a => ArrowZero (Bijection a) Source # Instance detailsDefined in Data.Invertible.Bijection MethodszeroArrow :: Bijection a b c # Source # ||| is Left-biased, and uses only the left argument's biFrom. Instance detailsDefined in Data.Invertible.Bijection Methodsleft :: Bijection a b c -> Bijection a (Either b d) (Either c d) #right :: Bijection a b c -> Bijection a (Either d b) (Either d c) #(+++) :: Bijection a b c -> Bijection a b' c' -> Bijection a (Either b b') (Either c c') #(|||) :: Bijection a b d -> Bijection a c d -> Bijection a (Either b c) d # Invariant2 (Bijection ((->) :: Type -> Type -> Type)) Source # Instance detailsDefined in Data.Invertible.Bijection Methodsinvmap2 :: (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) -> Bijection (->) a b -> Bijection (->) c d # (Semigroupoid a, Arrow a) => BiArrow' (Bijection a) Source # Instance detailsDefined in Control.Invertible.BiArrow (Semigroupoid a, Arrow a) => BiArrow (Bijection a) Source # Instance detailsDefined in Control.Invertible.BiArrow Methods(<->) :: (b -> c) -> (c -> b) -> Bijection a b c Source #invert :: Bijection a b c -> Bijection a c b Source # Category a => Category (Bijection a :: Type -> Type -> Type) Source # Instance detailsDefined in Data.Invertible.Bijection Methodsid :: Bijection a a0 a0 #(.) :: Bijection a b c -> Bijection a a0 b -> Bijection a a0 c # Semigroupoid a => Groupoid (Bijection a :: Type -> Type -> Type) Source # Instance detailsDefined in Data.Invertible.Bijection Methodsinv :: Bijection a a0 b -> Bijection a b a0 # Semigroupoid a => Semigroupoid (Bijection a :: Type -> Type -> Type) Source # Instance detailsDefined in Data.Invertible.Bijection Methodso :: Bijection a j k1 -> Bijection a i j -> Bijection a i k1 # Monad m => Arrow (MonadArrow (<->) m) Source # Instance detailsDefined in Control.Invertible.MonadArrow Methodsarr :: (b -> c) -> MonadArrow (<->) m b c #first :: MonadArrow (<->) m b c -> MonadArrow (<->) m (b, d) (c, d) #second :: MonadArrow (<->) m b c -> MonadArrow (<->) m (d, b) (d, c) #(***) :: MonadArrow (<->) m b c -> MonadArrow (<->) m b' c' -> MonadArrow (<->) m (b, b') (c, c') #(&&&) :: MonadArrow (<->) m b c -> MonadArrow (<->) m b c' -> MonadArrow (<->) m b (c, c') # Source # Instance detailsDefined in Control.Invertible.MonadArrow MethodszeroArrow :: MonadArrow (<->) m b c # Source # Instance detailsDefined in Control.Invertible.MonadArrow Methods(<+>) :: MonadArrow (<->) m b c -> MonadArrow (<->) m b c -> MonadArrow (<->) m b c # Source # Instance detailsDefined in Control.Invertible.MonadArrow Methodsleft :: MonadArrow (<->) m b c -> MonadArrow (<->) m (Either b d) (Either c d) #right :: MonadArrow (<->) m b c -> MonadArrow (<->) m (Either d b) (Either d c) #(+++) :: MonadArrow (<->) m b c -> MonadArrow (<->) m b' c' -> MonadArrow (<->) m (Either b b') (Either c c') #(|||) :: MonadArrow (<->) m b d -> MonadArrow (<->) m c d -> MonadArrow (<->) m (Either b c) d # Invariant (Bijection ((->) :: Type -> Type -> Type) b) Source # Instance detailsDefined in Data.Invertible.Bijection Methodsinvmap :: (a -> b0) -> (b0 -> a) -> Bijection (->) b a -> Bijection (->) b b0 # Monad m => BiArrow' (MonadArrow (<->) m) Source # Instance detailsDefined in Control.Invertible.MonadArrow (Semigroupoid a, Arrow a) => Functor (Bijection a b) Source # Instance detailsDefined in Control.Invertible.Functor Methodsfmap :: (a0 <-> b0) -> Bijection a b a0 -> Bijection a b b0 Source # Monoidal (Bijection ((->) :: Type -> Type -> Type) ()) Source # Instance detailsDefined in Control.Invertible.Monoidal Methodsunit :: Bijection (->) () () Source #(>*<) :: Bijection (->) () a -> Bijection (->) () b -> Bijection (->) () (a, b) Source #

type (<->) = Bijection (->) infix 2 Source #

Specialization of Bijection to function arrows. Represents both a function, f, and its (presumed) inverse, g, represented as f :<->: g.