Support arbitrary-sized unions with N-ary sum type #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there, I've been interested to have this feature for some time, since in my company we've frequently needed to add to the
EitherN
module whenever we add something. So I've taken a stab at implementing it. I used a sum type similar toNS
fromgenerics-sop
(but specialized to not be kind-polymorphic).Since this is a larger change I'm of course happy to hear the perspective of the maintainers and users and try to accommodate your preferences.
With the existing round-trip tests Im fairly confident the implementation is correct. I also ran another test to check the consistency with the existing implementation, which adds to my confidence. (That test is not included in this patch, because it removes the old types).
I'm not sure how well covered the unions are by the benchmark suite. I think the performance should at least not be too much different, but Im also interested to validate that and make adjustments if necessary. However, I wanted to start the conversation here first at least, to make sure there is buy-in for this change before going further.