These are chat archives for non/algebra

12th
Dec 2015
Rüdiger Klaehn
@rklaehn
Dec 12 2015 16:02
I got a question regarding default instances. It seems that the default Eq defined for maps is VectorEq, which requires both an Eq instance and a AdditiveMonoid instance. Why is that?
With the traditional definition of Eq that only requires an Eq for the elements MapEq, it would not be possible to define a Group for Map. Nevertheless I would prefer having MapEq the default.
I think the canonical definition of equality should be that two things are equal if it is not possible to distinguish between them (obviously disregarding things like eq and System.identityHashCode). But clearly VectorEq does not fit this definition.
Rüdiger Klaehn
@rklaehn
Dec 12 2015 16:08
Basically, I would like default Eq instances to follow this definition (from Wikipedia)
Given any x and y, x = y if, given any predicate P, P(x) if and only if P(y).
(I noticed this by trying to define a Group instance for my own map type, and noticing that I can't if I use a normal definition of Eq)
@non @johnynek @denisrosset any comments on this?