How can the following all be true?
Hask
category, the Objects are Haskell types and the
Morphisms are Haskell functions. Values play no role in Hask
. A
and terminating at the same Object A
.id
function.id
function must be identical to
the value of the argument passed in.If the identity morphism is defined in category theory as an arrow from an Object A back to the same Object A, isn't that description satisfied by any and every Haskell function of type f :: A -> A
?
There is another question whose answers might also perhaps cover this topic, but they seem to assume a level of familiarity with category theory that I unfortunately do not possess.
This seems to me a very basic beginner-level question. So can someone supply an answer using only language, symbols and notional constructs that a beginner can understand?
I'm not sure I really understood the point of your question.
But identity in categories must satisfy
id . f = f
g . id = g
for any f,g
of the correct types. So id
is not just any random function A -> A
, it is the one satisfying the requirements above.
Note that, in Hask, we have that for any value a :: A
id . (const a) = const a
hence
id (const a ()) = const a ()
hence
id a = a
So id
is really what we expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With