Basically, I have two, e.g. GraphMorphisms, and I want to compare them. This theory is supposed to be equational, right? Is it?
In short, I could not figure out.
So I decide, let me take a look, how do they compare two typed sets in Scala? Here's how:
override def equals(that: Any): Boolean = that match {
case that: GenSet[_] =>
(this eq that) ||
(that canEqual this) &&
(this.size == that.size) &&
(try this subsetOf that.asInstanceOf[GenSet[A]]
catch { case ex: ClassCastException => false })
case _ =>
false
}
So there. Maybe it's not equational, after all. I mean, in my case.
How do they do it in Haskell then?
This is how:
instance Eq1 Set where
liftEq eq m n =
size m == size n && liftEq eq (toList m) (toList n)
Typeclasses seem to beat classes. Fuck...