If Hask is the category of all haskell types (with functions as arrows), then can we think of ob(Hask)
(that is, the collection of objects of Hask) as equal to *
?
If not, in what sense is this wrong?
At this point it must be some sort of cliché to link to the Hask article on the Haskell wiki every time a question about Hask gets brought up, but here it is.
To expand on the wiki a little I think the answer to this question is a very boring yes, but only because Hask is defined such that the objects of Hask are types of kind ⭑. The full definition is:
Let every type of kind ⭑ be an object of Hask, except undefined
. I think "Yes" is essentially the answer to your question until a devil's advocate brings up undefined
and seq
, at which point the answer necessarily becomes more and more complicated.
Let every function of type A -> B
be an arrow from the object corresponding to type A
to the object corresponding to type B
.
Very carefully choose a notion of equality for the arrows, which may or may not exist (see ensuing discussion) or maybe throw out seq
or maybe give up altogether.
Let the arrow corresponding to id :: A -> A
be the identity arrow for each object.
Let .
, which is associative &c., correspond to the composition of arrows, which must be associative &c.
This is by no means the only category you can model Haskell programs with but we do this and bless it with the Hask name because a lot of other notions then naturally correspond to Haskell computation. For example, an endofunctor on this category would conveniently be represented by something of kind ⭑ -> ⭑ with a (lawful) function taking fmap :: ((a :: ⭑) -> (b :: ⭑)) -> ((f a :: ⭑) -> (f b :: ⭑))
.