Skip to content

Instantly share code, notes, and snippets.

@eparejatobes
Last active December 14, 2015 10:29
Show Gist options
  • Save eparejatobes/5072626 to your computer and use it in GitHub Desktop.
Save eparejatobes/5072626 to your computer and use it in GitHub Desktop.
Image of a type constructor; compiler crashes, probably related with https://issues.scala-lang.org/browse/SI-5559
trait ImageOfAux {
type F[_]
type A
type FA
}
trait ImageOf[FA0, F0[_]] extends ImageOfAux {
type F[_] = F0[_]
type FA = FA0
type A
}
object ImageOf {
type img[F[_]] = {
type λ[FA] = ImageOf[FA,F]
}
implicit def inImage[F0[_], A0, FA0 <: F0[A0]]:
ImageOf[FA0, F0] =
new ImageOf[FA0,F0] {
type A = A0
}
}
object Test {
import ImageOf._
class HasList[S: img[List]#λ] {}
// compiler crashes here
// object stringList extends HasList[List[String]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment