2010-06-01 14:38:56 +02:00
|
|
|
/* sbt -- Simple Build Tool
|
|
|
|
|
* Copyright 2010 Mark Harrah
|
|
|
|
|
*/
|
2010-05-31 00:42:58 +02:00
|
|
|
package sbt
|
|
|
|
|
|
|
|
|
|
import Types._
|
|
|
|
|
|
|
|
|
|
sealed trait HList
|
|
|
|
|
{
|
2010-06-01 14:38:56 +02:00
|
|
|
type ToM[M[_]] <: MList[M]
|
2010-05-31 00:42:58 +02:00
|
|
|
type Up <: MList[Id]
|
|
|
|
|
def up: Up
|
|
|
|
|
}
|
|
|
|
|
sealed trait HNil extends HList
|
|
|
|
|
{
|
2010-06-01 14:38:56 +02:00
|
|
|
type ToM[M[_]] = MNil
|
|
|
|
|
type Up = MNil
|
2010-05-31 00:42:58 +02:00
|
|
|
def up = MNil
|
|
|
|
|
def :+: [G](g: G): G :+: HNil = HCons(g, this)
|
|
|
|
|
}
|
|
|
|
|
object HNil extends HNil
|
|
|
|
|
final case class HCons[H, T <: HList](head : H, tail : T) extends HList
|
|
|
|
|
{
|
2010-06-01 14:38:56 +02:00
|
|
|
type ToM[M[_]] = MCons[H, tail.ToM[M], M]
|
|
|
|
|
type Up = MCons[H, tail.Up, Id]
|
|
|
|
|
def up = MCons[H,tail.Up, Id](head, tail.up)
|
2010-05-31 00:42:58 +02:00
|
|
|
def :+: [G](g: G): G :+: H :+: T = HCons(g, this)
|
|
|
|
|
}
|