dotty-feature-requests icon indicating copy to clipboard operation
dotty-feature-requests copied to clipboard

Lower bound on AnyKind

Open s5bug opened this issue 5 years ago • 0 comments

As of yet,

type I = [X <: AnyKind] =>> X
type K = [X <: AnyKind] =>> [Y <: AnyKind] =>> X
type S = [X[_][_] <: AnyKind] =>> [Y[_] <: AnyKind] =>> [Z <: AnyKind] =>> X[Z][Y[Z]]

@main def hi: Unit = {
  
  type R = S[K[S[I]]][K]
  // type R[α][β] = S[K[S[I]]][K][α][β]
  //              = K[S[I]][α][K[α]][β]
  //              = S[I][K[α]][β]
  //              = I[β][K[α][β]]
  //              = I[β][α]
  //              = β[α]
  
  val a: R[Int][List] = List(1, 2)
  
}

doesn't compile.

(I tried with ? and * as well instead of _; I might be using the wrong kind thing in that snippet.)

(Also see: https://github.com/lampepfl/dotty/issues/6451)

s5bug avatar Dec 25 '19 09:12 s5bug