Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class (Category (Domain f :: o1 -> o1 -> *), Category (Codomain f :: o2 -> o2 -> *)) => Functor f k | f -> k where
- objectMap :: forall f a. Functor f (KProxy :: KProxy (o1 -> o2)) => Tagged `(f, a)` (Object (Domain f) a :- Object (Codomain f) (FMap f a :: o2))
- fmap :: forall f a b. Functor f (KProxy :: KProxy (o1 -> o2)) => f -> Domain f a b -> Codomain f (FMap f a :: o2) (FMap f b :: o2)
- data Comp k f g where
- data IdentityF c where
- data CanonicalF f where
- CanonicalF :: Functor f => CanonicalF f
Documentation
class (Category (Domain f :: o1 -> o1 -> *), Category (Codomain f :: o2 -> o2 -> *)) => Functor f k | f -> k where Source
The class of functors f
from Domain f
to Codomain f
. Rather than
indexing functors on the type of their object mapping, Functor is indexed on
the phantom type variable f
. This allows the object mapping to be any type
family FMap f
, and for multiple functors to exist between categories. As a
consequence, a proxy k
for the kind of FMap f
must be given as a second
parameter to Functor.
The mapping of objects of Domain f
to objects of Codomain f
.
type Domain f :: o1 -> o1 -> * Source
The domain of f
.
type Codomain f :: o2 -> o2 -> * Source
The codomain of f
.
morphMap :: Tagged f (Domain f (a :: o1) (b :: o1) -> Codomain f (FMap f a :: o2) (FMap f b :: o2)) Source
The mapping of morphisms of Domain f
to morphisms of Codomain f
, tagged on the type f
.
Functor f => Functor * * (CanonicalF f) (KProxy (* -> *)) | |
Category k c => Functor k k (IdentityF k c) (KProxy (k -> k)) | |
(Functor o2 o3 f (KProxy (o2 -> o3)), Functor o1 o2 g (KProxy (o1 -> o2)), (~) (o2 -> o2 -> *) (Domain o2 f) (Codomain o2 g)) => Functor o1 o3 (Comp o2 (KProxy o2) f g) (KProxy (o1 -> o3)) | |
Category k c => Functor k ((,) k k) (Diag k c) (KProxy (k -> (,) k k)) | |
ProductCategory k c => Functor ((,) k k) k (ProductF k c) (KProxy ((,) k k -> k)) | |
(Category o1 c1, Category o2 c2, Category o3 c3) => Functor ((,) * *) * (CompFF o1 o2 o3 c1 c2 c3) (KProxy ((,) * * -> *)) |
objectMap :: forall f a. Functor f (KProxy :: KProxy (o1 -> o2)) => Tagged `(f, a)` (Object (Domain f) a :- Object (Codomain f) (FMap f a :: o2)) Source
Proof that functors map objects to objects. Defines a functor from Cat to (:-).
fmap :: forall f a b. Functor f (KProxy :: KProxy (o1 -> o2)) => f -> Domain f a b -> Codomain f (FMap f a :: o2) (FMap f b :: o2) Source
The composition of functors. The type variable k
is a proxy for the kind of the objects of the codomain of g
.
(:.:) :: (Functor f (KProxy :: KProxy (o2 -> o3)), Functor g (KProxy :: KProxy (o1 -> o2)), (Domain f :: o2 -> o2 -> *) ~ Codomain g) => f -> g -> Comp (KProxy :: KProxy o2) f g |
(Functor o2 o3 f (KProxy (o2 -> o3)), Functor o1 o2 g (KProxy (o1 -> o2)), (~) (o2 -> o2 -> *) (Domain o2 f) (Codomain o2 g)) => Functor o1 o3 (Comp o2 (KProxy o2) f g) (KProxy (o1 -> o3)) | |
type FMap k k1 (Comp o2 (KProxy o2) f g) a = FMap o2 k1 f (FMap k o2 g a) | |
type Domain k (Comp k1 (KProxy k1) f g) = Domain k g | |
type Codomain k (Comp k1 (KProxy k1) f g) = Codomain k f |
The identity functor.
data CanonicalF f where Source
Functors derived from Prelude's Functor.
CanonicalF :: Functor f => CanonicalF f |
Functor f => Functor * * (CanonicalF f) (KProxy (* -> *)) | |
type FMap * * (CanonicalF f) a = f a | |
type Domain * (CanonicalF f) = (->) | |
type Codomain * (CanonicalF f) = (->) |