mirror of https://github.com/sbt/sbt.git
Introduce and use KList.Aux
This commit is contained in:
parent
3cd8f4dadf
commit
34f9e56311
|
|
@ -59,7 +59,7 @@ object AList {
|
|||
}
|
||||
|
||||
/** AList for the arbitrary arity data structure KList. */
|
||||
def klist[KL[M[_]] <: KList[M] { type Transform[N[_]] = KL[N] }]: AList[KL] = new AList[KL] {
|
||||
def klist[KL[M[_]] <: KList.Aux[M, KL]]: AList[KL] = new AList[KL] {
|
||||
def transform[M[_], N[_]](k: KL[M], f: M ~> N) = k.transform(f)
|
||||
def foldr[M[_], T](k: KL[M], f: (M[_], T) => T, init: T): T = k.foldr(f, init)
|
||||
override def apply[M[_], C](k: KL[M], f: KL[Id] => C)(implicit app: Applicative[M]): M[C] = k.apply(f)(app)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ sealed trait KList[+M[_]] {
|
|||
/** Discards the heterogeneous type information and constructs a plain List from this KList's elements. */
|
||||
def toList: List[M[_]]
|
||||
}
|
||||
object KList {
|
||||
type Aux[+M[_], Transform0[N[_]]] = KList[M] { type Transform[N[_]] = Transform0[N] }
|
||||
}
|
||||
|
||||
final case class KCons[H, +T <: KList[M], +M[_]](head: M[H], tail: T) extends KList[M] {
|
||||
final type Transform[N[_]] = KCons[H, tail.Transform[N], N]
|
||||
|
|
|
|||
Loading…
Reference in New Issue