-
Notifications
You must be signed in to change notification settings - Fork 5
Configurable sum of product styling #35
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
Conversation
| @JsonClassDiscriminator("tag") | ||
| @Parcelize | ||
| @Serializable | ||
| sealed class Enum : Parcelable { | ||
| @Parcelize | ||
| @Serializable | ||
| @SerialName("dataCons0") | ||
| data class DataCons0(val contents: Record0) : Enum() | ||
|
|
||
| @Parcelize | ||
| @Serializable | ||
| @SerialName("dataCons1") | ||
| data class DataCons1(val contents: Record1) : Enum() | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tadfisher Yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah yeah yeah!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid adding annotations for a user.
e25d3c9 to
72b0396
Compare
|
|
||
| -- * Options for encoding types | ||
|
|
||
| -- ** Option type and defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here are just passing options down to enumExp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good, though a refactor to ReaderT might be nice for keeping the option passing cleaner.
| -- | Make a void type (empty enum) | ||
| mkVoid :: | ||
| () => | ||
| Options -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like a good use of ReaderT Options - maybe put that in with MoatM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah lol i see that you already have this as a refactoring potential!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is definitely getting tedious to pass these around over and over.
This is a much less intrusive version of #33. Introduce a configuration option to handle the various encoding styles of Aeson (see https://hackage.haskell.org/package/aeson-2.0.1.0/docs/Data-Aeson-TH.html#t:SumEncoding). We are using a non-existent style that was suggested in this PR.
Spawns a few issues: