0

If I end up with an e.g. Stream[Id, A], I can translate the effect Pure with the trivial Id ~> Pure.

However, if I've ended up with a stream of a different strict effect type, e.g. Stream[Option, A], how can I convert this to a Option[Vector[A]] (or something)? The best way I've found so far is to translate the stream into some other type that does have a Sync instance, run the stream, but then it's not straightforward to convert it back as Sync admits all Throwables as failures whereas Option naturally allows only None. What's the better way of approaching this?

Hugh
  • 8,872
  • 2
  • 37
  • 42
  • How did you get a `Stream[Option, A]` in the first place? – Daenyth Jun 19 '18 at 20:10
  • Hah, I'm not defending it as a useful type. I had a `org.http4s.HttpService[F]` that I instantiated with `F = Option` and the bodies of the responses are then `Stream[Option, Byte]`. – Hugh Jun 21 '18 at 11:50

0 Answers0