1
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?

Alper
  • 3,424
  • 4
  • 39
  • 45

1 Answers1

2

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.

Bartosz Milewski
  • 11,012
  • 5
  • 36
  • 45
  • I thank you for your answer but for somebody who isn't deep into this stuff this is really hard to understand. – Alper Nov 27 '19 at 09:03