A stream eliminator runs an incremental Stream and turns its effects and outputs into a final result. Operations such as toList and run also determine how failures escape the stream: evaluating a Stream[Task, Int] can produce a Task failure wrapping the original exception. section 15.3.2
A failing stream
val s: Stream[Task, Int] = Stream.eval(Task("asdf".toInt)) Converting s with an eliminator such as toList or run yields a failed task whose error wraps NumberFormatException. Error handling can then be attached to the Stream or Pull before elimination. section 15.3.2
Elimination connects incremental computation to effect handling:
- Stream uses Task as its effect, while Task supplies attempt and handleErrorWith for the error channel. section 15.3.2
- Pull.step requires MonadThrow so errors can be interpreted while the stream is being stepped. section 15.3.2
