final
type Eq[A] =
A × A -> scala.Boolean
final
class WithEquality[A,E <: Equality](val value: A, val eq: Eq[A])
abstract class Equality {
final
type V[A] =
WithEquality[A,this.type]
implicit final
def asV[A](a: A)(implicit eq: Eq[A]): V[A] =
new WithEquality(a, eq)
}
More generically, this could be done assuming products and truth values. change V[A] to A ⊗ (A ⊗ A -> T) and do everything explicitly. Why not make it explicit too in the Scala case, after all?
For
Scala
:More generically, this could be done assuming products and truth values. change
V[A]
toA ⊗ (A ⊗ A -> T)
and do everything explicitly. Why not make it explicit too in theScala
case, after all?