Append instances for Set and Map

This commit is contained in:
Mark Harrah 2012-01-27 21:09:11 -05:00
parent d82757f595
commit 26ec82ed73
1 changed files with 8 additions and 0 deletions

View File

@ -38,4 +38,12 @@ object Append
def appendValues(a: Classpath, b: Seq[File]): Classpath = a ++ Attributed.blankSeq(b)
def appendValue(a: Classpath, b: File): Classpath = a :+ Attributed.blank(b)
}
implicit def appendSet[T, V <: T]: Sequence[Set[T], Set[V], V] = new Sequence[Set[T], Set[V], V] {
def appendValues(a: Set[T], b: Set[V]): Set[T] = a ++ b
def appendValue(a: Set[T], b: V): Set[T] = a + b
}
implicit def appendMap[A,B, X <: A, Y <: B]: Sequence[Map[A,B], Map[X,Y], (X,Y)] = new Sequence[Map[A,B], Map[X,Y], (X,Y)] {
def appendValues(a: Map[A,B], b: Map[X,Y]): Map[A,B] = a ++ b
def appendValue(a: Map[A,B], b: (X,Y)): Map[A,B] = a + b
}
}