[Haskell-beginners] Is there a name for the following?
byorgey at seas.upenn.edu
Mon Jun 2 01:58:20 UTC 2014
On Sun, Jun 01, 2014 at 05:55:21PM -0400, Gregory Malecha wrote:
> Hello --
> I'm wondering if there is any "name" for a functor "F" that has a function
> with the following type:
> (a -> F b) -> F (a -> b)
> (F a -> F b) -> F (a -> b)
> If there is, I would imagine it being related to Applicative in some way,
> though clearly there are many Applicatives that do not have an
> implementation of this.
As for the first type, any distributive/representable functor
will have such a function---that is, when F a is isomorphic to (r ->
a) for some type r. Then it is just
(a -> r -> b) -> (r -> a -> b)
I rather suspect that these are the *only* functors that will work,
but I'm not sure how to prove it off the top of my head. Intuitively,
if F does not have some fixed structure, i.e. it is isomorphic to a
sum type, then (given that 'a' can be infinite) there is no way to
combine the infinitely many F structures resulting from the (a -> F b)
function into a single F structure on the right.
Relatedly, you may be interested in
which are very similar, although they quantify over 'a' rather than 'F'.
I do not have any good intuition about the second type.
More information about the Beginners