Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | sjoerd@w3future.com |
- data Cat where
- data CatW
- type family Dom ftag :: * -> * -> *
- type family Cod ftag :: * -> * -> *
- class (Category (Dom ftag), Category (Cod ftag)) => Functor ftag where
- type family ftag :% a :: *
- data Id (~>) = Id
- data g :.: h where
- data Const c1 c2 x where
- type ConstF f = Const (Dom f) (Cod f)
- data Opposite f where
- data EndoHask where
- data Proj1 c1 c2 = Proj1
- data Proj2 c1 c2 = Proj2
- data f1 :***: f2 = f1 :***: f2
- data DiagProd (~>) = DiagProd
- data Tuple1 c1 c2 a = Tuple1 (Obj c1 a)
- data Tuple2 c1 c2 a = Tuple2 (Obj c2 a)
- data Hom (~>) = Hom
- type :*-: x (~>) = Hom ~> :.: Tuple1 (Op ~>) ~> x
- homX_ :: Category ~> => Obj ~> x -> x :*-: ~>
- type :-*: (~>) x = Hom ~> :.: Tuple2 (Op ~>) ~> x
- hom_X :: Category ~> => Obj ~> x -> ~> :-*: 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 |
|
HasTerminalObject Cat |
|
HasInitialObject Cat | The empty category is the initial object in |
HasBinaryProducts Cat | |
HasBinaryCoproducts Cat | |
CartesianClosed 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.
Functor instances
The identity functor on (~>)
The composition of two functors.
The dual of a functor
Related to the product category
Proj1
is a bifunctor that projects out the first component of a product.
Proj2
is a bifunctor that projects out the second component of a product.
f1 :***: f2
is the product of the functors f1
and f2
.
f1 :***: f2 |
DiagProd
is the diagonal functor for products.
Tuple1
tuples with a fixed object on the left.
Tuple2
tuples with a fixed object on the right.
Hom functors
The Hom functor, Hom(,), a bifunctor contravariant in its first argument and covariant in its second argument.