I'm trying to create a circular process using scalaz-stream by merging one source of data with a filtered version coming from the same data source. Here is a simple example of what I have so far :
val s1 = Process.emitAll(1 to 10).toSource
val w = wye.merge[Int]
val s2 = w.filter(_ < 5)
val w2 = s1.wye(s2)(w)
But it doesn't compile as s2
is a Process[Process.Env[Int,Int]#Y,Int]
but needs to be a Process[Task,Int]
.
How can I specify that s2 is both the input (with s1
) and the output of w
?