I am learning from the "Free Applicative Functors". Surely, the question I am going to ask is kind of aside with respect to main idea of the paper, but still...
...on the page 6 there is an attempt to generalize Functor
to MultiFunctor
:
class Functor f ⇒ MultiFunctor f where
fmap0 :: a → f a
fmap1 :: (a → b) → f a → f b
fmap1 = fmap
fmap2 :: (a → b → c) → f a → f b → f c
...
I can not see how this definition is justified from the category theory's viewpoint: fmap2
seems to be just a bifunctor, i.e. a functor defined on a product category. By definition, product category is given by all possible ordered pairs of objects and morphisms are pairs as well, hence: fmap2 :: (a -> a', b -> b') -> (f a, f b) -> (f a', f b')
looks and feels like more appropriate signature.
I can understand the way of thinking standing behing the (a -> b -> c) -> f a -> f b -> f c
choice: it is just the most obvious way to take known (a -> b) -> f a -> f b
signature and force it to work with binary functions, rather then unary. But isMultiFunctor
(given by the definition above) actually a bi-/multifunctor in the sense that category theory expects it to be?
P.S. The reason why I am curious is that it seems like one can't get to the Applicative
by generalizing Functor
, though paper states that one can.