I use this code from scalaz stream website, it is working with to method, but it failed when I try to use append, it looks like into an infinite loop and never finish. The reason I want to use append method is that I dont want to rewrite the file by using to method.
io.linesR(t)
.intersperse("\n")
.pipe(text.utf8Encode)
.to(io.fileChunkW(target))
.run.run //success
files.foreach(t => {
io.linesR(t)
.intersperse("\n")
.pipe(text.utf8Encode)
.append(io.fileChunkW(target))
.run.run
}) //the program keeps running, it looks like in an infinite loop
I am confused about it, can someone explain to me what happen here
Many thanks in advance