Skip to content

Instantly share code, notes, and snippets.

@soc
Created January 19, 2012 02:20
Show Gist options
  • Select an option

  • Save soc/1637270 to your computer and use it in GitHub Desktop.

Select an option

Save soc/1637270 to your computer and use it in GitHub Desktop.
trait Eq[-T]
def equal[T](left : T, right : T)(implicit eqT : Eq[T]) = true
implicit def eqInt = new Eq[Int]{}
trait List[T]
implicit def eqList[T](implicit eqT : Eq[T]) = new Eq[List[T]] {}
class ListListInt extends List[List[Int]]
def ints = new ListListInt
equal[ListListInt](ints, ints)
equal(ints, ints)
equal[List[List[Int]]](ints, ints)
equal[ListListInt](ints, ints)
equal(ints, ints)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment