I have a FoldSignal
case class as following.
/**
* Represents a signal that is manipulated to using the functional "fold" operation
* @param s Underlying signal
* @param start seed for the fold
* @param f fold function
*/
case class FoldSignal[T, U](s: Signal[T], start: U, f: (U, T) => U) extends Signal[U]
And I used it to create a function in Signal[T]:
sealed trait Signal[T]{
...
/**
* Return a delta of signals in windows
*/
def delta(implicit ev: T =:= (_, DateTime) ): Signal[T] = {
def foldFun(queue: List[T], t: T) = {
println(queue(0))
queue(0)._1
}
FoldSignal(this, Nil, foldFun)
}
...
}
where Signal[T] is a sealed trait:
/**
* Signal is a AST object represents a value that is continuously emitted. It does
* not specify anything about the source of the signal.
*/
sealed trait Signal[T] {...}
And it comes up an error:
Error:(71, 22) type mismatch;
found : scala.collection.immutable.Nil.type
required: T
FoldSignal(this, Nil, foldFun)
^
Could someone help me, please! Thanks!