Portability  nonportable 

Stability  experimental 
Maintainer  sjoerd@w3future.com 
Safe Haskell  SafeInferred 
 data Cat where
 data CatW
 class (Category (Dom ftag), Category (Cod ftag)) => Functor ftag where
 data Id k = Id
 data g :.: h where
 data Const c1 c2 x where
 type ConstF f = Const (Dom f) (Cod f)
 data Opposite f where
 data OpOp k = OpOp
 data OpOpInv k = OpOpInv
 data Proj1 c1 c2 = Proj1
 data Proj2 c1 c2 = Proj2
 data f1 :***: f2 = f1 :***: f2
 data DiagProd k = DiagProd
 data Tuple1 c1 c2 a = Tuple1 (Obj c1 a)
 type Swap c1 c2 = (Proj2 c1 c2 :***: Proj1 c1 c2) :.: DiagProd (c1 :**: c2)
 swap :: (Category c1, Category c2) => Swap c1 c2
 type Tuple2 c1 c2 a = Swap c2 c1 :.: Tuple1 c2 c1 a
 tuple2 :: (Category c1, Category c2) => Obj c2 a > Tuple2 c1 c2 a
 data Hom k = Hom
 type :*: x k = Hom k :.: Tuple1 (Op k) k x
 homX_ :: Category k => Obj k x > x :*: k
 type :*: k x = Hom k :.: Tuple2 (Op k) k x
 hom_X :: Category k => Obj k x > k :*: x
Cat
Functors are arrows in the category Cat.
CatA :: (Functor ftag, Category (Dom ftag), Category (Cod ftag)) => ftag > Cat (CatW (Dom ftag)) (CatW (Cod ftag)) 
Category Cat 

HasBinaryCoproducts Cat  The coproduct of categories 
HasBinaryProducts Cat  The product of categories 
HasInitialObject Cat  The empty category is the initial object in 
HasTerminalObject Cat 

CartesianClosed Cat  Exponentials in 
HasNaturalNumberObject Cat 
We need a wrapper here because objects need to be of kind *, and categories are of kind * > * > *.
Functors
class (Category (Dom ftag), Category (Cod ftag)) => Functor ftag whereSource
Functors map objects and arrows.
type Dom ftag :: * > * > *Source
The domain, or source category, of the functor.
type Cod ftag :: * > * > *Source
The codomain, or target category, of the functor.
:%
maps objects.
Functor Add  Ordinal addition is a bifuntor, it concattenates the maps as it were. 
Functor Forget  Turn 
Category k => Functor (Hom k)  The Hom functor, Hom(,), a bifunctor contravariant in its first argument and covariant in its second argument. 
Category k => Functor (DiagProd k) 

Category k => Functor (OpOpInv k)  The 
Category k => Functor (OpOp k)  The 
(Category (Dom f), Category (Cod f)) => Functor (Opposite f)  The dual of a functor 
Category k => Functor (Id k)  The identity functor on k 
Category k => Functor (Magic k)  Since there is nothing to map in 
Category k => Functor (CodiagCoprod k) 

HasBinaryCoproducts k => Functor (CoproductFunctor k)  Binary coproduct as a bifunctor. 
HasBinaryProducts k => Functor (ProductFunctor k)  Binary product as a bifunctor. 
CartesianClosed k => Functor (ExpFunctor k)  The exponential as a bifunctor. 
Category (f (Fix f)) => Functor (Wrap f)  
(Functor m, ~ (* > * > *) (Dom m) k, ~ (* > * > *) (Cod m) k) => Functor (KleisliAdjG m)  
(Functor m, ~ (* > * > *) (Dom m) k, ~ (* > * > *) (Cod m) k) => Functor (KleisliAdjF m)  
(Functor m, ~ (* > * > *) (Dom m) k, ~ (* > * > *) (Cod m) k) => Functor (ForgetAlg m) 

(Functor m, ~ (* > * > *) (Dom m) k, ~ (* > * > *) (Cod m) k) => Functor (FreeAlg m) 

(Functor f1, Functor f2) => Functor (:***: f1 f2) 

(Category c1, Category c2) => Functor (Proj2 c1 c2) 

(Category c1, Category c2) => Functor (Proj1 c1 c2) 

(Category (Cod g), Category (Dom h)) => Functor (:.: g h)  The composition of two functors. 
(Functor f, Functor h) => Functor (Wrap f h) 

(Functor f, Functor g, ~ (* > * > *) (Dom f) (Dom g), ~ (* > * > *) (Cod f) (Cod g)) => Functor (NatAsFunctor f g)  A natural transformation 
(Functor f1, Functor f2) => Functor (:+++: f1 f2) 

(Category c1, Category c2) => Functor (Inj2 c1 c2) 

(Category c1, Category c2) => Functor (Inj1 c1 c2) 

(Category (Dom p), Category (Cod p)) => Functor (:+: p q)  The coproduct of two functors, passing the same object to both functors and taking the coproduct of the results. 
(Category (Dom p), Category (Cod p)) => Functor (:*: p q)  The product of two functors, passing the same object to both functors and taking the product of the results. 
HasColimits j k => Functor (ColimitFunctor j k)  If every diagram of type 
HasLimits j k => Functor (LimitFunctor j k)  If every diagram of type 
(Category j, Category k) => Functor (Diag j k)  The diagonal functor from (index) category J to k. 
(Category c1, Category c2) => Functor (Tuple c1 c2)  
(Category c1, Category c2) => Functor (Apply c1 c2) 

(Category k, Functor f, ~ (* > * > *) (Dom f) (Op k), ~ (* > * > *) (Cod f) (>)) => Functor (Yoneda k f) 

(Functor z, Functor s, ~ (* > * > *) (Dom z) Unit, ~ (* > * > *) (Cod z) (Dom s), ~ (* > * > *) (Dom s) (Cod s)) => Functor (PrimRec z s)  
TensorProduct f => Functor (Replicate f a)  Replicate a monoid a number of times. 
(Category c1, Category c2) => Functor (Tuple1 c1 c2 a1) 

(Category c1, Category c2) => Functor (Const c1 c2 x)  The constant functor. 
(Category c, Category d, Category e) => Functor (FunctorCompose c d e)  Composition of functors is a functor. 
(Category c1, Category c2) => Functor (Cotuple2 c1 c2 a2) 

(Category c1, Category c2) => Functor (Cotuple1 c1 c2 a1) 

Functor instances
type ConstF f = Const (Dom f) (Cod f)Source
The constant functor with the same domain and codomain as f.
Related to the product category
f1 :***: f2 
swap :: (Category c1, Category c2) => Swap c1 c2Source
swap
swaps the 2 categories of the product of categories.
tuple2 :: (Category c1, Category c2) => Obj c2 a > Tuple2 c1 c2 aSource
Tuple2
tuples with a fixed object on the right.