2010-06-01 14:38:56 +02:00
|
|
|
/* sbt -- Simple Build Tool
|
|
|
|
|
* Copyright 2010 Mark Harrah
|
|
|
|
|
*/
|
2010-05-31 03:14:18 +02:00
|
|
|
package sbt
|
|
|
|
|
|
|
|
|
|
import Node._
|
|
|
|
|
import Types._
|
|
|
|
|
|
|
|
|
|
trait Node[A[_], T]
|
|
|
|
|
{
|
2010-06-01 14:38:56 +02:00
|
|
|
type Inputs <: MList[A]
|
2010-06-07 14:53:21 +02:00
|
|
|
type Results = Inputs#Map[Result]
|
2010-05-31 03:14:18 +02:00
|
|
|
|
2010-06-01 14:38:56 +02:00
|
|
|
val inputs: Inputs
|
2010-05-31 03:14:18 +02:00
|
|
|
def unitDependencies: Iterable[A[_]]
|
|
|
|
|
|
2010-06-07 14:53:21 +02:00
|
|
|
def work(results: Results, units: UnitResults[A]): Either[A[T], T]
|
2010-05-31 03:14:18 +02:00
|
|
|
}
|
2010-06-01 14:38:56 +02:00
|
|
|
|
2010-05-31 03:14:18 +02:00
|
|
|
object Node
|
|
|
|
|
{
|
2010-06-07 14:53:21 +02:00
|
|
|
/*def pure[T](f: () => T): PureNode[T]= map[Id, T, MNil](MNil, Nil)((_,_) => f() )
|
2010-05-31 03:14:18 +02:00
|
|
|
|
2010-06-07 14:53:21 +02:00
|
|
|
def map[A[_], T, Inputs0 <: MList[A]](inputs0: Inputs0, deps0: Iterable[A[_]])(work0: (Inputs0#Map[Result], UnitResults[A]) => T):
|
|
|
|
|
Node[A,T] { type Inputs = Inputs0 } =
|
2010-06-01 14:38:56 +02:00
|
|
|
new Node[A,T] {
|
|
|
|
|
type Inputs = Inputs0
|
|
|
|
|
val inputs = inputs0
|
|
|
|
|
def unitDependencies = deps0
|
2010-06-07 14:53:21 +02:00
|
|
|
def work(results: Results, units: UnitResults[A]) = Right(work0(results, units))
|
2010-06-01 14:38:56 +02:00
|
|
|
}
|
2010-05-31 03:14:18 +02:00
|
|
|
|
2010-06-07 14:53:21 +02:00
|
|
|
type PureNode[T] = Node[Id, T] { type Inputs = MNil; type Results = MNil }*/
|
|
|
|
|
type UnitResults[A[_]] = Iterable[(A[_], Incomplete)]
|
2010-05-31 03:14:18 +02:00
|
|
|
}
|