[avro] Add Either typeclass support#1004
Draft
RustedBones wants to merge 2 commits intomainfrom
Draft
Conversation
RustedBones
commented
Jul 22, 2024
Comment on lines
+263
to
+267
| // `Either[A, B]` is a `UNION` of `[A, B]` and must default to first type `A` | ||
| override def makeDefault(d: Either[A, B])(cm: CaseMapper): fa.ToT = { | ||
| require(d.isLeft, "Either[A, B] can only default to Left[A]") | ||
| fa.to(d.left.get)(cm): @nowarn | ||
| } |
Contributor
Author
There was a problem hiding this comment.
In scala Either is Right biased but here I chose Left as possible default based on type order definition. WDYT?
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1004 +/- ##
==========================================
- Coverage 95.34% 95.31% -0.03%
==========================================
Files 56 56
Lines 1978 1987 +9
Branches 154 157 +3
==========================================
+ Hits 1886 1894 +8
- Misses 92 93 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Support scala Either as a avro type union
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Support scala Either as a avro type union