The required change is essentially as follows:
output.openOutput{out =>
out.write(3)
out.write("hi")
}
for {
outp <- output.outputProcessor
out = outp.asOutput
} {
out.write(3)
out.write(4)
}
Or: Since out's write operations return Processors they can be interleaved within the for comprehension if needed like:
for {
out <- output.outputProcessor
_ <- out.write(3)
_ <- out.write(4)
} ()