concat-examples-0.3.0.0: Some examples of compiling to categories
Safe HaskellSafe-Inferred
LanguageHaskell2010

ConCat.Isomorphism

Description

Category of Isomorphisms.

Synopsis

Documentation

data Iso k a b Source #

Constructors

(a `k` b) :<-> (b `k` a) infix 0 

Instances

Instances details
AssociativePCat k => AssociativePCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

lassocP :: Ok3 (Iso k) a b c => Iso k (Prod (Iso k) a (Prod (Iso k) b c)) (Prod (Iso k) (Prod (Iso k) a b) c) Source #

rassocP :: Ok3 (Iso k) a b c => Iso k (Prod (Iso k) (Prod (Iso k) a b) c) (Prod (Iso k) a (Prod (Iso k) b c)) Source #

AssociativeSCat k => AssociativeSCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

lassocS :: Oks (Iso k) '[a, b, c] => Iso k (Coprod (Iso k) a (Coprod (Iso k) b c)) (Coprod (Iso k) (Coprod (Iso k) a b) c) Source #

rassocS :: Oks (Iso k) '[a, b, c] => Iso k (Coprod (Iso k) (Coprod (Iso k) a b) c) (Coprod (Iso k) a (Coprod (Iso k) b c)) Source #

BraidedPCat k => BraidedPCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

swapP :: Ok2 (Iso k) a b => Iso k (Prod (Iso k) a b) (Prod (Iso k) b a) Source #

BraidedSCat k => BraidedSCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

swapS :: Ok2 (Iso k) a b => Iso k (Coprod (Iso k) a b) (Coprod (Iso k) b a) Source #

Category k => Category (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Associated Types

type Ok (Iso k) :: Type -> Constraint Source #

Methods

id :: Ok (Iso k) a => Iso k a a Source #

(.) :: forall b c a. Ok3 (Iso k) a b c => Iso k b c -> Iso k a b -> Iso k a c Source #

MonoidalPCat k => MonoidalPCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

(***) :: Ok4 (Iso k) a b c d => Iso k a c -> Iso k b d -> Iso k (Prod (Iso k) a b) (Prod (Iso k) c d) Source #

first :: forall a a' b. Ok3 (Iso k) a b a' => Iso k a a' -> Iso k (Prod (Iso k) a b) (Prod (Iso k) a' b) Source #

second :: Ok3 (Iso k) a b b' => Iso k b b' -> Iso k (Prod (Iso k) a b) (Prod (Iso k) a b') Source #

MonoidalSCat k => MonoidalSCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

(+++) :: Ok4 (Iso k) a b c d => Iso k c a -> Iso k d b -> Iso k (Coprod (Iso k) c d) (Coprod (Iso k) a b) Source #

left :: forall a a' b. Oks (Iso k) '[a, b, a'] => Iso k a a' -> Iso k (Coprod (Iso k) a b) (Coprod (Iso k) a' b) Source #

right :: Oks (Iso k) '[a, b, b'] => Iso k b b' -> Iso k (Coprod (Iso k) a b) (Coprod (Iso k) a b') Source #

UnitCat k => UnitCat (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

lunit :: Ok (Iso k) a => Iso k a (Prod (Iso k) (Unit (Iso k)) a) Source #

lcounit :: Ok (Iso k) a => Iso k (Prod (Iso k) (Unit (Iso k)) a) a Source #

runit :: Ok (Iso k) a => Iso k a (Prod (Iso k) a (Unit (Iso k))) Source #

rcounit :: Ok (Iso k) a => Iso k (Prod (Iso k) a (Unit (Iso k))) a Source #

Closed k => Closed (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

(^^^) :: Ok4 (Iso k) a b c d => Iso k d c -> Iso k a b -> Iso k (c :=> a) (d :=> b) Source #

(FunctorCat k h, ZipCat k h) => FunctorCat (Iso k) h Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

fmapC :: Ok2 (Iso k) a b => Iso k a b -> Iso k (h a) (h b) Source #

unzipC :: Ok2 (Iso k) a b => Iso k (h (a :* b)) (h a :* h b) Source #

OkFunctor k h => OkFunctor (Iso k) h Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

okFunctor :: Ok' (Iso k) a |- Ok' (Iso k) (h a) Source #

(FunctorCat k h, ZipCat k h) => ZipCat (Iso k) h Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

zipC :: Ok2 (Iso k) a b => Iso k (h a :* h b) (h (a :* b)) Source #

HasRep (Iso k a b) Source # 
Instance details

Defined in ConCat.Isomorphism

Associated Types

type Rep (Iso k a b) Source #

Methods

repr :: Iso k a b -> Rep (Iso k a b) Source #

abst :: Rep (Iso k a b) -> Iso k a b Source #

type Ok (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

type Ok (Iso k) = Ok k
type Rep (Iso k a b) Source # 
Instance details

Defined in ConCat.Isomorphism

type Rep (Iso k a b) = k a b :* k b a

inv :: Iso k a b -> Iso k b a Source #

involution :: (a `k` a) -> Iso k a a Source #

Form an ivolution from a _self-inverse_ arrow.

isoFwd :: Iso k a b -> a `k` b Source #

isoRev :: Iso k a b -> b `k` a Source #

type (<->) = Iso (->) infix 0 Source #

via :: (Category k, Ok2 k a b) => Iso k b b -> Iso k a b -> Iso k a a Source #

Apply one isomorphism via another

pattern Iso :: (a `k` b) -> (b `k` a) -> Iso k a b Source #

newIso :: Newtype a => a <-> O a Source #

repIso :: Representable f => f a <-> (Rep f -> a) Source #

reindexId :: forall f g. (Representable f, Representable g, Rep f ~ Rep g) => f <--> g Source #

coerceIso :: (CoerceCat k a b, CoerceCat k b a) => Iso k a b Source #

class (Category k, OkExp k) => Closed k where Source #

Methods

(^^^) :: Ok4 k a b c d => (d `k` c) -> (a `k` b) -> (c :=> a) `k` (d :=> b) infixr 8 Source #

Instances

Instances details
Closed k => Closed (Iso k) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

(^^^) :: Ok4 (Iso k) a b c d => Iso k d c -> Iso k a b -> Iso k (c :=> a) (d :=> b) Source #

Closed (->) Source # 
Instance details

Defined in ConCat.Isomorphism

Methods

(^^^) :: Ok4 (->) a b c d => (d -> c) -> (a -> b) -> (c :=> a) -> (d :=> b) Source #

dom :: (Closed k, Ok3 k c a d) => (d `k` c) -> (c :=> a) `k` (d :=> a) Source #

cod :: (Closed k, Ok3 k c a b) => (a `k` b) -> (c :=> a) `k` (c :=> b) Source #

foo1 :: forall k a b c d a' c'. (Closed k, Ok k c, Ok k a, Ok k d, Ok k c', Ok k b, Ok k a') => (d `k` c') -> (c' `k` c) -> (a `k` a') -> (a' `k` b) -> (c :=> a) `k` (d :=> b) Source #

foo2 :: forall k a b c d a' c'. (Closed k, Ok k c, Ok k a, Ok k d, Ok k c', Ok k b, Ok k a') => (d `k` c') -> (c' `k` c) -> (a `k` a') -> (a' `k` b) -> (c :=> a) `k` (d :=> b) Source #

type (<-->) f g = forall a. f a <-> g a infix 0 Source #

Natural isomorphism

fmapIso :: Functor f => (f <--> g) -> (a -> b) -> g a -> g b Source #

pureIso :: Applicative f => (f <--> g) -> a -> g a Source #

appIso :: Applicative f => (f <--> g) -> g (a -> b) -> g a -> g b Source #

memptyIso :: Monoid a => (a <-> b) -> b Source #

mappendIso :: Monoid a => (a <-> b) -> b -> b -> b Source #

joinIso :: (MCoproductCat k, Ok3 k a c d) => ((c `k` a) :* (d `k` a)) <-> ((c :+ d) `k` a) Source #

forkIso :: (MProductCat k, Ok3 k a c d) => ((a `k` c) :* (a `k` d)) <-> (a `k` (c :* d)) Source #

curryIso :: (ClosedCat k, Ok3 k a b c) => ((a :* b) `k` c) <-> (a `k` (b -> c)) Source #