-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Total transformation for Cats' NonEmptyX[A] -> NonEmptyX[B]
#569
Comments
Yes, long story short: it's unmaintainable. At first it's one Next request will be for Then, someone might ask why they cannot convert List into NonEmptyList (as Partial) or NonEmptyList into List (as Total transformer). Build-in collections used Factories and Iterable interface, Cats would be on Traversable and Applicative, using std with Cats would be... adding new Cats instances for std types? Pulling Cats into core module which struggles to be dependency-free? Then we add Java Collections, because you might want to convert from Finally: DSL allows overriding items. You can write:
For this DSL to work, conversion has to be handled in the macro, the macro has to be aware of how it can iterate over/build a collection, this mechanism has to be extensible so that it would work (for now) with: Standard Library, Cats, Java Collections, and without pulling all dependencies for everyone. In practice, we developed our own type classes which allow us to iterate over and build data types. And non-empty collections has to be build with a builder which returns For now I am not planning to work on it, but I would not add |
Thank you for the detailed explanation! |
Just to be clear: it sounds like a good idea (and it might be surprising to users that it does not work currently), but it would require some thinking to come up with a solution which:
It's doable and probably the solution will be rather simple, but it will take some time to figure it out, and go through several possible options and their ups and downs. |
NonEmptyX[A] -> NonEmptyX[B]
NonEmptyX[A] -> NonEmptyX[B]
Released in 1.5.0 |
Is there a reason why these aren't in cats module?
The text was updated successfully, but these errors were encountered: