Skip to content

Instantly share code, notes, and snippets.

@milessabin
Created June 9, 2021 11:13
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/6754bdd2780f578f2079530ed3e9d7f5 to your computer and use it in GitHub Desktop.
Save milessabin/6754bdd2780f578f2079530ed3e9d7f5 to your computer and use it in GitHub Desktop.
miles@tarski:~% cs launch scala3-repl
scala> trait A
| trait B
| type M[X] = X match
| case A => Int
| case B => String
|
// defined trait A
// defined trait B
scala> val x: String = ??? : M[B]
1 |val x: String = ??? : M[B]
| ^^^^^^^^^^
| Found: M[B]
| Required: String
scala> class Inv[T]
// defined class Inv
scala> type M[X] = Inv[X] match
| case Inv[A] => Int
| case Inv[B] => String
|
scala> val x: String = ??? : M[B]
scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:345)
... 28 elided
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment