Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Encoder/Decoder for Nothing #1519

Open
LukaJCB opened this issue Aug 19, 2020 · 1 comment
Open

Add Encoder/Decoder for Nothing #1519

LukaJCB opened this issue Aug 19, 2020 · 1 comment

Comments

@LukaJCB
Copy link
Contributor

LukaJCB commented Aug 19, 2020

Ran into a problem with an ADT with multiple type parameters that was due to there being no Nothing codec in circe. This may be controversial, but here's a motivating example:

sealed trait ADT[+A, +B]

case class Foo[+A, +B](val a: A, val b: B) extends ADT[A, B]
case class Bar[+B](val b: B) extends ADT[Nothing, B]

implicit def adtEncoder[A: Encoder, B: Encoder]: Encoder[ADT[A, B]] = ...
implicit def adtDecoder[A: Decoder, B: Decoder]: Decoder[ADT[A, B]] = ...

Now if I create a Bar, I don't get to have a codec for it. I know I could introduce a second type parameter for Bar to mitigate this, but assume it comes from a third party library.

@hardmettle
Copy link

hardmettle commented Nov 28, 2020

@travisbrown picking this up as part of LSUG meetup .

  • (Harsh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants