Skip to content

Instantly share code, notes, and snippets.

@rootmos
Created May 7, 2017 11:52
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 rootmos/0f0e8226f1d2adc479cb9fce599f0281 to your computer and use it in GitHub Desktop.
Save rootmos/0f0e8226f1d2adc479cb9fce599f0281 to your computer and use it in GitHub Desktop.
import scala.annotation.tailrec
object Nothingness extends App {
@tailrec
def diverge[A](): A = diverge[A]()
trait A
implicit def `A and ¬A is a contradiction`(implicit a: A, notA: A => Nothing): Nothing = notA(a)
implicit val notA: A => Nothing = { _ => diverge() }
implicit val proofOfA = new A {}
implicit def `Embrace the nothingness`[P, Q](implicit p: P): Q = implicitly[Nothing]
trait B
trait C
val b: B = new C {}
val i: Int = b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment