Skip to content

Instantly share code, notes, and snippets.

@milessabin
Created September 14, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milessabin/bad6ab9e72c06813b8f80ecf3e1e7772 to your computer and use it in GitHub Desktop.
Save milessabin/bad6ab9e72c06813b8f80ecf3e1e7772 to your computer and use it in GitHub Desktop.
import scala.language.higherKinds
class Cartesian[F[_]] {
trait Arbitrary1
trait Arbitrary2
implicit val fa1: F[Arbitrary1] = null.asInstanceOf
implicit val fa2: F[Arbitrary2] = null.asInstanceOf
class QED
implicit def proof(implicit fa12: F[(Arbitrary1, Arbitrary2)]): QED = null
}
trait Foo[T]
object Foo {
implicit def pair[A, B](implicit fa: Foo[A], fb: Foo[B]): Foo[(A, B)] = new Foo[(A, B)] {}
}
object Test {
object FooIsCartesian extends Cartesian[Foo]
def test(implicit fc: FooIsCartesian.QED): Unit = ()
test
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment