map :: (a -> b) -> f a -> f b
for example for lists []
map :: (a -> b) -> [a] -> [b]
and for Maybe
map :: (a -> b) -> Maybe a -> Maybe b
and for ((->) t)
map :: (a -> b) -> ((->) t a) -> ((->) t b)
which is the same (syntax change only) as:
map :: (a -> b) -> (t -> a) -> (t -> b)
There is only one possible function with this type. That is, the type implies the program. It is function composition. Function composition is a specialisation of map.
Note the absence of "length" or even "structure" in this latter case.
The map function, in all instances, does need to preserve two things however.
forall x. map id x == x
forall f g x. map f (map g x) == map (f . g) x