[Haskell-cafe] Re: Unique functor instance

DavidA polyomino at f2s.com
Tue Nov 25 09:02:25 EST 2008

Luke Palmer <lrpalmer <at> gmail.com> writes:

> I've been wondering, is it ever possible to have two (extensionally)
> different Functor instances for the same type?  I do mean in Haskell;
> i.e. (,) doesn't count.  I've failed to either come up with any
> examples or prove that they all must be the same using the laws.
> Thanks,
> Luke

A related question would be: are there two abstractions whose underlying 
representations (as algebraic data types) are isomorphic?

For example, suppose that we represented both lists and sets as [a]. One would 
expect the Functor instances for list and set to be different, since sets 
can't contain duplicates. Unfortunately, it's not possible to express this in 
Haskell, because we can't assume an Eq constraint when defining our Functor 

I suspect that the answer to the question is, yes, you can have different 
Functor instances. All you need is a sum-product type that it's possible to 
interpret as two different abstractions, leading to two different Functor 

More information about the Haskell-Cafe mailing list