1

I have a Process[Task,A]. A contains a Seq of Bs

case class A(elems:Seq[B])

I would like to transform the Process[Task,A] into a Process[Task,B]

def streamOfAs:Process[Task,A] = ???

streamOfBs1:Process[Task,Member] = streamOfAs.flatMap(Process.emit(_.elems)) //Compiler error
streamOfBs2:Process[Task,Member] = streamOfAs pipe process1.lift((a:A) => a.elems) //yields Process[Task,Seq[B]]

are there any buildtin functions to achieve this?

Atle
  • 428
  • 3
  • 11

1 Answers1

1

If I understand correctly the case class A is essentially function A => Seq[B]

then solution would be perhaps

val sourceB: Process[Task,B] = sourceA.flatMap(emitAll(_.elems))
Pavel Chlupacek
  • 864
  • 5
  • 8
  • You are right. But there seems to be some weirdness with my IDE: When i let the compiler infer the type, i indeed get Process[Task,B], but when i explicitly set the type, i get a compiler error. – Atle Dec 12 '14 at 17:35