3 ms·
I think category theory is just the wrong way to look at it. A category is quite an abstract thing and it takes a reasonable mathematical background just to hav
by dan-robertson 5y ago
I think category theory is just the wrong way to look at it. A category is quite an abstract thing and it takes a reasonable mathematical background just to have some good examples to work with (I don’t really think type system categories are good to work with.)
I prefer to just write down the type and stare at it and think about what sort of functions could have that type. Later you can look at the rules. And this mostly means one needs to have written a little (eg) Haskell so that the one can read simple types. The signature of fmap looks like:
fmap :: (a -> b) -> functor a -> functor b
It should easy to guess what sort of types and functions could satisfy that. The rule restricts the possibilities more:
fmap (\x -> f (g x)) a == fmap f (fmap g a)