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

Scala 3 Union types don't work well #505

Open
lihaoyi opened this issue Jul 9, 2023 · 2 comments
Open

Scala 3 Union types don't work well #505

lihaoyi opened this issue Jul 9, 2023 · 2 comments

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Jul 9, 2023

Overall ticket to supersede the following specific issues:

  1. Union Types: work... but could be better supported? #481
  2. UPickle changes the meaning of an empty string encoded as a union #478
  3. Serialize intersection types? #387

We never had special handling for Scala 3 unions in the past, and so whatever behavior is happening now is somewhat arbitrary, not well defined, and probably not intentional. We should come up with some design for handling these kinds of types

@mio-19
Copy link

mio-19 commented Sep 4, 2024

I would like to suggest implementing ReadWriter for unions when members can be distinguished by java.lang.Class.
Something like

def union2RW[A:ClassTag,B:ClassTag](implicit a: ReadWriter[A], b: ReadWriter[B]): ReadWriter[A | B]

@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 4, 2024

@mio-19 sound reasonable!

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