[Haskell-cafe] lawless instances of Functor

Dan Piponi dpiponi at gmail.com
Mon Jan 4 19:38:19 EST 2010


On Mon, Jan 4, 2010 at 4:15 PM, Paul Brauner <paul.brauner at loria.fr> wrote:

> I wonder why this isn't some "classic" category theory result (maybe it is ?)

It doesn't hold in category theory in general.

Haskell (or at least a certain subset) is special - many things that
just *look* category theoretical turn out to actually *be* category
theoretical. That's quite a strong statement. So, for example,
functions that have the type signature of a natural transformation are
in fact natural transformations (which tells you non-trivial facts
about the function). And you've found that things that are only
half-defined functors are actually full-blown functors (subject to
someone providing a rigorous proof of this...). This is useful. If
you're using QuickCheck to convince yourself you've implemented a
functor correctly, you only need to test it on id.
--
Dan


More information about the Haskell-Cafe mailing list