[Haskell-cafe] lawless instances of Functor

Dan Piponi dpiponi at gmail.com
Mon Jan 4 18:15:20 EST 2010


On Mon, Jan 4, 2010 at 3:01 PM, Derek Elkins <derek.a.elkins at gmail.com> wrote:

> Ignoring bottoms the free theorem for fmap can be written:
>
> If h . p = q . g then fmap h . fmap p = fmap q . fmap g

When I play with http://haskell.as9x.info/ft.html I get examples that
look more like:

If fmap' has the same signature as the usual fmap for a type

and h . p = q . g

then fmap h . fmap' p = fmap' q . fmap g

>From which it follows that if fmap' id = id then fmap' is fmap.

But I don't know how to prove that uniformly for all types, just the
ones I generated free theorems for.
--
Dan


More information about the Haskell-Cafe mailing list