0

I have a scalaz-stream process:

val src = Process.repeatEval(Task(in.take())) : Process[Task, Option[T]]

How do I get rid of Option?

So far I've used collect but it doesn't feel elegant:

src.collect { case Some(x) => x } : Process[Task, T]

Is there a better way?

piotrga
  • 1,243
  • 12
  • 12

1 Answers1

0

Your solution is correct, but the implementation is already present in scalaz-stream (<= 0.8), in process1.stripNone:

src.pipe(process1.stripNone)

or

src |> process1.stripNone

Many other transformations (possibly stateful) are defined in process1, so it's worth looking through the file for possibly useful transformations.

Gary Coady
  • 1,196
  • 9
  • 13