Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created September 15, 2011 22:07
Show Gist options
  • Select an option

  • Save missingfaktor/1220623 to your computer and use it in GitHub Desktop.

Select an option

Save missingfaktor/1220623 to your computer and use it in GitHub Desktop.
Contravariant functor
scala> case class Person(name: String, age: Int)
defined class Person
scala> implicitly[math.Ordering[Int]] contramap ((_: Dog).age)
res124: scala.math.Ordering[Dog] = scala.math.Ordering$$anon$3@fc6ef0
scala> implicitly[Equal[Int]] contramap ((_: Dog).age)
res126: scalaz.Equal[Dog] = scalaz.Equals$$anon$2@df06c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment