Having the following class which is in a CPS-context (@cps[Unit]) how would I implement the Seq-trait? Do I have to leave the standard traits like Seq aside and just implement map, flatmap and foreach in the cps-context?
class DataFlowVariable[T] {
def apply(): T @cps[Unit] = ...
}
class DataFlowStream[T] extends Seq[T] {
override def iterator: Iterator[T] = new Iterator[T] {
private val iter = queue.iterator
def hasNext: Boolean = iter.hasNext
def next: T = { // needed: next: T @cps[Unit] !
val dfvar = iter.next
// dfvar() // not possible as dvar.apply has type "T @cps[Unit]"
}
}
}