# Composition of compostion as a functor

"Composition of Composition" (i.e., (.) . (.)) in Haskell), has type (a -> b) -> (c -> d -> a) -> c -> d -> b. Apparently, this is an instance of fmap, i.e. a functor between two categories.

The question is: what is the domain and the codomain of this functor? How do we interpret this functor in terms of functional programming?

• No, fmap can not have that type. fmap . fmap can, since fmap = (.) for the functor X -> - (for any X). In your case, the two functors are c -> - and d -> -. (For total obfuscation, fmap . fmap can be also be written as fmap fmap fmap) – chi Nov 30 '18 at 17:22
• Anyway, I think that this question is a bit too much Haskell-specific to be here. On StackOverflow we routinely handle Haskell questions asking for the underlying categorical ideas (and how faithfully, or not, they appear in Haskell). – chi Nov 30 '18 at 17:25
• @chi It is certainly not true that this question is specific to Haskell - we get categories in any pure subset of typed functional programming languages. Writing this in SML for instance does not magically change the categories involved. – xuq01 Nov 30 '18 at 21:12
• @xuq01 Actually, it likely does change the categories involved (at least to the extent that it is meaningful to talk about categories). – Derek Elkins Dec 1 '18 at 17:29