fork from https://github.com/scalaz/scalaz-stream