[Haskell-cafe] Categories (cont.)
ok at cs.otago.ac.nz
ok at cs.otago.ac.nz
Fri Dec 21 03:40:12 CET 2012
> I've perhaps been trying everyones patiences with my noobish CT
> questions, but if you'll bear with me a little longer: I happened to
> notice that there is in fact a Category class in Haskell base, in
> Control.Category:
>
> quote:
> --------
> class Category cat where
>
> A class for categories. id and (.) must form a monoid.
>
> Methods
>
> id :: cat a a
This says that 'cat' must be a type constructor with two
type arguments. In an instance of this type, a and b will
refer to objects of the category and cat a b to the morphisms.
Integer is NOT a type constructor with two type arguments,
so instance Category Integer makes no sense.
[] is a type constructor with one type argument,
not two, so instance Category [] makes no sense either.
Can you make Either an instance of Category?
Can you make (,) an instance of Category?
Can you make (a copy of) -> an instance of Category a different way?
More information about the Haskell-Cafe
mailing list