Reputation: 3953
fantasy-land/id :: Category c => () -> c a a
I don't really understand what this signature says? id
is a method that takes zero parameters and returns something that is a Category and two other things.
Is that correct? What's the point of this?
Upvotes: 1
Views: 102
Reputation: 11630
A category consists of objects and morphisms (arrows). If you want to define a category inside Haskell, you pretty much are stuck with objects as types. But for any two objects you may define a set of morphisms: the hom-set. Here, c
is a type constructor that takes two objects (types), say a
and b
and produces a hom-set c a b
. In the simplest example just replace c
with (->)
. In this case c a b
becomes a->b
(using infix notation). By the same token c a a
corresponds to a->a
. One of these morphisms is designated as the identity morphism. The function () -> c a a
picks that morphism. The complete definition must also include the composition operator (.)
that takes two composable hom-sets and produces a third, and the laws. Unit and associativity laws are not expressible in Haskell, though.
Upvotes: 2