let next s = try Some (next_exn s) with Stream.Failure -> None