A type
f is a Functor if it provides a function
fmap
which, given any types
a and
b lets you apply any
function from
(a -> b) to turn an
f a into an
f b, preserving the structure of
f. Furthermore
f needs to adhere to the following:
Note, that the second law follows from the free theorem of the type
fmap and the first law, so you need only check that the former
condition holds. See these articles by
School of Haskell or
David Luposchainsky for an explanation.