On Wed, Apr 21, 2010 at 5:25 AM, Max Rabkin <max.rabkin@gmail.com> wrote:
On Wed, Apr 21, 2010 at 1:44 AM, Edward Kmett <ekmett@gmail.com> wrote:Wikipedia's definition of structural equality is an object-oriented
> 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.
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).
--Max