Created
June 1, 2019 16:42
-
-
Save vvviiimmm/38d3298465487bb96263fb9eb9d2d252 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
object Main extends App { | |
trait Nat { | |
type +[A <: Nat] <: Nat | |
type *[A <: Nat] <: Nat | |
type ! <: Nat | |
} | |
trait Z extends Nat { | |
type +[A <: Nat] = A | |
type *[A <: Nat] = Z | |
type ! = _1 | |
} | |
trait S[N <: Nat] extends Nat { | |
type +[A <: Nat] = N# +[S[A]] | |
type *[A <: Nat] = A# +[N# *[A]] | |
type ! = S[N]# *[N# !] | |
} | |
type _1 = S[Z] | |
type _2 = S[_1] | |
type _3 = S[_2] | |
type _4 = S[_3] | |
type _5 = S[_4] | |
type _6 = S[_5] | |
implicitly[_3# ! =:= _6] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment