Before understanding functor, it is necessary to understand the category theory of abstract algebra, the knowledge of category theory as the foreshadowing, the feeling functor is not so difficult to understand.
A category C includes:
-
an object-composed class Ob (C)
-
objects. Each State shot F has a "source object" A and "target object" B, and both A and B are within OB (C). It is therefore written as f:a B, and the F is a state shot from a to B. A "state shot" of all A-to-b states, labeled Hom (b) or HOMC (A, B).
-
to three objects A, B and C, two Hom (A, A, a) * Hom (B,c), Hom (A,c) is called a state-injection compound; the composition of f:a-B and G:b-C is written as G. F or GF.
This state-injection composite satisfies the following axioms:
-
-
(unit) for any object x, there is a one-state shot 1x:x, X, so that each state shot F:a-B, there will be 1b.f = f = f.1a. This state is called the unit state shot of X.
Functor Anatomy of Haskell abstract concept