Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct bounds for higher-kinded GADT skolems
- Loading branch information
Showing
3 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
object Test { | ||
sealed trait Foo[+A] // sealed or not doesn't matter | ||
case class ImplA[A](a: A) extends Foo[A] | ||
case class ImplAny[A](a: Any) extends Foo[A] | ||
|
||
trait Bar[+G[_]] // must be covariant | ||
|
||
def err[F[_]](): Unit = { | ||
val x: Foo[Foo[Bar[F]]] = ??? | ||
|
||
x match { | ||
case ImplAny(ImplAny(_)) => ??? | ||
case ImplAny(ImplA(_)) => ??? | ||
case ImplA(_) => ??? | ||
case ImplAny(_) => ??? | ||
case _ => ??? | ||
} | ||
|
||
x match { | ||
case ImplA(ImplA(_)) => ??? | ||
case ImplA(ImplAny(_)) => ??? | ||
case ImplA(y) => y.toString | ||
case ImplA(y) => y match { | ||
case ImplA(_) => ??? | ||
case _ => ??? | ||
} | ||
case ImplA(y) => y | ||
case _ => ??? | ||
} | ||
|
||
() | ||
} | ||
} |