summaryrefslogtreecommitdiff
path: root/test/files/pos/t8170b.scala
blob: 53036f6c8a762b19b92ee853e1417f08568399d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import language._

object ScalaZeee {
  trait HFold[M[_], U] {
    type Apply[E, A <: U] <: U
  }
  trait GenericCons[M[_], H, +T <: GenericList[M]] extends GenericList[M] {
    val tail: T
    override type Folded[N[X] >: M[X], U, F <: HFold[N, U]] = F#Apply[H, tail.Folded[N, U, F]]
  }
  val KNil: GenericList[Nothing] = ???
  sealed trait GenericList[+M[_]] {
     type Folded[N[X] >: M[X], U, F <: HFold[N, U]] <: U
  }
}
 
object TypelevelUsage {
  import ScalaZeee._
  type T = GenericCons[Some, String, KNil.type]
  val klist1: T = ???
  type T2 = klist1.Folded[Option, Int, HFold[Option, Int]]
  val count2: T2 = ???
   
  count2.ensuring(x => true).toChar // trigger an implicit search
}