[Haskell-cafe] Re: Re: instance Eq (a -> b)

Max Rabkin max.rabkin at gmail.com
Wed Apr 21 05:25:22 EDT 2010

On Wed, Apr 21, 2010 at 1:44 AM, Edward Kmett <ekmett at gmail.com> wrote:
> Eq doesn't state anywhere that the instances should be structural, though in
> general where possible it is a good idea, since you don't have to worry
> about whether or not functions respect your choice of setoid.

Wikipedia's definition of structural equality is an object-oriented
one, but if by structural equality you mean the natural equality on
algebraic datatypes (as derived automatically), I don't believe this
is quite the case. If the type is abstract, surely the Eq instance
need only be a quotient w.r.t. the operations defined on it. Thus, for
example, two Sets can be considered equal if they contain the same
elements, rather than having identical tree shapes (except that
Data.Set exports unsafe functions, like mapMonotonic which has an
unchecked precondition).


More information about the Haskell-Cafe mailing list