Last active
February 26, 2021 22:23
-
-
Save deanwampler/7943f64cac0e6d20d19de2cf43b1558a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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