Home > Software engineering >  Not Sure How to Write the Implicit for Equality Using Scalaz
Not Sure How to Write the Implicit for Equality Using Scalaz

Time:11-14

In Cats I can do

  import cats.Eq
  implicit val eq: Eq[Foo] = Eq.fromUniversalEquals[Foo]

How do I do this using Scalaz (7.3.1)? I tried this from the examples in the repo but I got a compile error:

  import scalaz._
  import Scalaz._
  implicit val eq: Equal[Foo] = Decidable[Equal].xderiving0(Foo)

CodePudding user response:

The equivalent universal equality representation in Scalaz would be:

    implicit val eq: Equal[Foo] = Equal.equalA[Foo]
  • Related