Http4s: Sync not needed?

Created on 6 Apr 2019  路  3Comments  路  Source: http4s/http4s

Hello I found a Sync is required in the following line:

https://github.com/http4s/http4s/blob/6901da3899540d25980b59cb51ff67f9f6e89935/core/src/main/scala/org/http4s/EntityDecoder.scala#L183

I saw in the git history there was a runSomething method but it鈥檚 now removed. Is the Sync still appropriate here? I could not find side effects.

[My understanding of the code is still poor though]

Most helpful comment

the Sync is required for compile.toVector.
At the moment fs2 requires Sync for compilation of Streams whose effects are not Pure/Fallible, which we will be keen to remove but haven't figured out how yet.
If you really don't like Sync, you can use a Compiler evidence, but that will require 2 type params so I don't think it's desirable

All 3 comments

I have two intuitions:

  1. Applicative is sufficient
  2. scalac is much better than my intuition

Would you like to give it a try and submit a PR if you can find a looser constraint that works?

the Sync is required for compile.toVector.
At the moment fs2 requires Sync for compilation of Streams whose effects are not Pure/Fallible, which we will be keen to remove but haven't figured out how yet.
If you really don't like Sync, you can use a Compiler evidence, but that will require 2 type params so I don't think it's desirable

I will close this issue, but do keep on reporting this sort of thing, because it _does_ happen fairly often that there are overly strong constraints due to old code :)

Was this page helpful?
0 / 5 - 0 ratings