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

Please consider upstreaming to Scala3 #40

Open
robmwalsh opened this issue Oct 28, 2022 · 1 comment
Open

Please consider upstreaming to Scala3 #40

robmwalsh opened this issue Oct 28, 2022 · 1 comment

Comments

@robmwalsh
Copy link

Hi, thanks for the awesome library! I'm using heaps of unions so this is a lifesaver. Would you consider upstreaming this to Scala3? I think this is a missing feature that really belongs in the standard lib.

@iRevive
Copy link
Owner

iRevive commented Oct 31, 2022

Hi.

When Scala 3 was released, I also expected this functionality to be a part of the standard library. And I still think it should be available out of the box.

I see several issues with upstreaming the library.
It's relatively simple to derive a Show typeclass, but things are getting complicated with io.circe.Decoder. In some scenarios, the decoding logic should rely on the discriminators (e.g. https://circe.github.io/circe/codecs/adt.html#the-future).

In terms of derivation, a union type is somewhat similar to a sealed trait (ignoring that type Union = String | String is a valid definition).
Hence, with a few adjustments, it should be possible to derive a typeclass utilizing Mirror.SumOf (a few hints typelevel/shapeless-3#21 (comment)).

Once I formalize my ideas, I will make a proposition in dotty repository.

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

No branches or pull requests

2 participants