Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement optional implicit allowing usage of circe decoders without EntityDecoder definition #1917
I think this is useful, but it's worth mentioning two reasons that this is not a default, and maybe even worth mentioning this in the docs.
Many APIs support multiple representations. There's one reasonable way to render a
Json, but there can be multiple reasonable ways to render a
This introduces incoherent instances. For instance, now we have two
EntityDecoder[F, String]. It surprises people which one wins.
If that doesn't scare people off, this technique is often useful.
I don't see any reason not to do an Encoder where we do the Decoder. And in that case, it'd be nice to not require two imports.
The first point is already mentioned in https://github.com/http4s/http4s/pull/1917/files#diff-dcf0079785763cffc8cb901dad9f0628R205 Should I clarify it?
And I doubt that incoherent instances are possible in the same scope: they result in ambiguous implicits error.
I looked at the diff, and not the wider context. You're right, I think the first point is covered well enough.
As for the second issue, a lexically scoped instance (e.g.,
I tried testing the implicit resolution and found that it does not compile at all. Somehow