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