From 0b5e6484ba6299b0621b6b8d9e944108dc7b1acb Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sun, 14 Aug 2011 10:53:37 -0400 Subject: [PATCH] drop unused KApply from settings --- util/collection/Settings.scala | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/util/collection/Settings.scala b/util/collection/Settings.scala index ddfb41b97..0b83eb86b 100644 --- a/util/collection/Settings.scala +++ b/util/collection/Settings.scala @@ -64,13 +64,6 @@ trait Init[Scope] def update[T](key: ScopedKey[T])(f: T => T): Setting[T] = new Setting[T](key, app(key :^: KNil)(hl => f(hl.head))) def app[HL <: HList, T](inputs: KList[Initialize, HL])(f: HL => T): Initialize[T] = new Apply(f, inputs) def uniform[S,T](inputs: Seq[Initialize[S]])(f: Seq[S] => T): Initialize[T] = new Uniform(f, inputs) - def kapp[HL <: HList, M[_], T](inputs: KList[({type l[t] = Initialize[M[t]]})#l, HL])(f: KList[M, HL] => T): Initialize[T] = new KApply[HL, M, T](f, inputs) - - // the following is a temporary workaround for the "... cannot be instantiated from ..." bug, which renders 'kapp' above unusable outside this source file - class KApp[HL <: HList, M[_], T] { - type Composed[S] = Initialize[M[S]] - def apply(inputs: KList[Composed, HL])(f: KList[M, HL] => T): Initialize[T] = new KApply[HL, M, T](f, inputs) - } def empty(implicit delegates: Scope => Seq[Scope]): Settings[Scope] = new Settings0(Map.empty, delegates) def asTransform(s: Settings[Scope]): ScopedKey ~> Id = new (ScopedKey ~> Id) { @@ -315,30 +308,6 @@ trait Init[Scope] if(undefs.isEmpty) Right(new Apply(f, tx transform get)) else Left(undefs) } } - - private[this] final class KApply[HL <: HList, M[_], T](val f: KList[M, HL] => T, val inputs: KList[({type l[t] = Initialize[M[t]]})#l, HL]) extends Initialize[T] - { - type InitializeM[T] = Initialize[M[T]] - type VInitM[T] = ValidatedInit[M[T]] - def dependsOn = dependencies(unnest(inputs.toList)) - def mapReferenced(g: MapScoped) = mapInputs( mapReferencedT(g) ) - def apply[S](g: T => S) = new KApply[HL, M, S](g compose f, inputs) - def evaluate(ss: Settings[Scope]) = f(inputs.transform[M]( nestCon(evaluateT(ss)) )) - def mapConstant(g: MapConstant) = mapInputs(mapConstantT(g)) - def mapInputs(g: Initialize ~> Initialize): Initialize[T] = - new KApply[HL, M, T](f, inputs.transform[({type l[t] = Initialize[M[t]]})#l]( nestCon(g) )) - def validateReferenced(g: ValidateRef) = - { - val tx = inputs.transform[VInitM](nestCon(validateReferencedT(g))) - val undefs = tx.toList.flatMap(_.left.toSeq.flatten) - val get = new (VInitM ~> InitializeM) { def apply[T](vr: VInitM[T]) = vr.right.get } - if(undefs.isEmpty) - Right(new KApply[HL, M, T](f, tx transform get)) - else - Left(undefs) - } - private[this] def unnest(l: List[Initialize[M[T]] forSome { type T }]): List[Initialize[_]] = l.asInstanceOf[List[Initialize[_]]] - } private[this] final class Uniform[S, T](val f: Seq[S] => T, val inputs: Seq[Initialize[S]]) extends Initialize[T] { def dependsOn = dependencies(inputs)