When you write Process(1, 2, 3)
, you get a Process[Nothing, Int]
, which is a process that doesn't have any idea about a specific context that it can make external requests against—it's just going to emit some stuff. This means that you can treat it as a Process0
, for example:
scala> Process(1, 2, 3).toList
res0: List[Int] = List(1, 2, 3)
It does also mean that you can't run
it, though, since run needs a "driver" context.
Since Process
is covariant in its first type parameter, you can use it in situations where you do have a more specific type for this context:
scala> import scalaz.concurrent.Task
import scalaz.concurrent.Task
scala> (Process(1, 2, 3): Process[Task, Int]).runLog.run
res1: IndexedSeq[Int] = Vector(1, 2, 3)
Or:
scala> Process(1, 2, 3).flatMap(i => Process.fill(3)(i)).runLog.run
res2: IndexedSeq[Int] = Vector(1, 1, 1, 2, 2, 2, 3, 3, 3)
I agree that the error is a little confusing, but in normal usage you won't generally run into this situation, since you'll be using the process in a context that will fix its type to something like Process[Task, Int]
.