Skip to content

Instantly share code, notes, and snippets.

@deanwampler
Last active February 26, 2021 22:23
Show Gist options
  • Save deanwampler/7943f64cac0e6d20d19de2cf43b1558a to your computer and use it in GitHub Desktop.
Save deanwampler/7943f64cac0e6d20d19de2cf43b1558a to your computer and use it in GitHub Desktop.
// Adapted from
// https://github.com/deanwampler/programming-scala-book-code-examples/blob/master/src/script/scala/progscala3/typesystem/deptypes/DependentTypesSimple.scala
import scala.compiletime.ops.boolean.* // Scala 2 uses _ as the wild card, which you can still use
val t1: true = true
val f1: ![true] = false // Note how the left-hand size has to be written
val tt1: true && true = true
val tf1: true && false = false
val ft1: false && true = false
val ff1: false && false = false
val tt2: true || true = true
val tf2: true || false = true
val ft2: false || true = true
val ff2: false || false = false
val tt3: true ^ true = false // Exclusive Or
val tf3: true ^ false = true
val ft3: false ^ true = true
val ff3: false ^ false = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment