From b033bc889d298ae7e1d084c1ab67ed15d5733a41 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sun, 12 Sep 2010 22:27:11 -0400 Subject: [PATCH] toString for HList and KList --- util/collection/HList.scala | 4 ++++ util/collection/KList.scala | 3 +++ 2 files changed, 7 insertions(+) diff --git a/util/collection/HList.scala b/util/collection/HList.scala index db2c9db85..df0391de8 100644 --- a/util/collection/HList.scala +++ b/util/collection/HList.scala @@ -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 diff --git a/util/collection/KList.scala b/util/collection/KList.scala index 81ef6afcd..aa9662917 100644 --- a/util/collection/KList.scala +++ b/util/collection/KList.scala @@ -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