mirror of https://github.com/sbt/sbt.git
toString for HList and KList
This commit is contained in:
parent
f884fa9cdd
commit
b033bc889d
|
|
@ -13,12 +13,16 @@ sealed trait HNil extends HList
|
|||
{
|
||||
type Wrap[M[_]] = HNil
|
||||
def :+: [G](g: G): G :+: HNil = HCons(g, this)
|
||||
|
||||
override def toString = "HNil"
|
||||
}
|
||||
object HNil extends HNil
|
||||
final case class HCons[H, T <: HList](head : H, tail : T) extends HList
|
||||
{
|
||||
type Wrap[M[_]] = M[H] :+: T#Wrap[M]
|
||||
def :+: [G](g: G): G :+: H :+: T = HCons(g, this)
|
||||
|
||||
override def toString = head + " :+: " + tail.toString
|
||||
}
|
||||
|
||||
object HList
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ final case class KCons[H, T <: HList, +M[_]](head: M[H], tail: KList[M,T]) exten
|
|||
def toList = head :: tail.toList
|
||||
|
||||
def combine[N[X] >: M[X]]: (H :+: T)#Wrap[N] = HCons(head, tail.combine)
|
||||
|
||||
override def toString = head + " :^: " + tail.toString
|
||||
}
|
||||
|
||||
sealed class KNil extends KList[Nothing, HNil]
|
||||
|
|
@ -40,6 +42,7 @@ sealed class KNil extends KList[Nothing, HNil]
|
|||
def :^: [M[_], H](h: M[H]) = KCons(h, this)
|
||||
def toList = Nil
|
||||
def combine[N[X]] = HNil
|
||||
override def toString = "KNil"
|
||||
}
|
||||
object KNil extends KNil
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue