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

Codec for nullary sum types #190

Closed
mxxo opened this issue May 21, 2019 · 0 comments
Closed

Codec for nullary sum types #190

mxxo opened this issue May 21, 2019 · 0 comments
Labels
codec Conversion between TOML and custom user data types

Comments

@mxxo
Copy link
Contributor

mxxo commented May 21, 2019

Take a simple sum data type like this:

data Color = Blue | Yellow | Green | Red

Without any fields, I'm not sure how to make the existing sum type parsing approach using prisms work here (as shown in the Readme).

mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
On a parse error, the alternative options are printed out using the Bounded and Enum
instances.
mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
@chshersh chshersh added the codec Conversion between TOML and custom user data types label May 21, 2019
mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
Co-Authored-By: Dmitrii Kovanikov <kovanikov@gmail.com>
mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
Co-Authored-By: Dmitrii Kovanikov <kovanikov@gmail.com>
mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
mxxo added a commit to mxxo/tomland that referenced this issue May 21, 2019
chshersh pushed a commit that referenced this issue May 22, 2019
* [#190] Add bimap for bounded nullary sum data type

On a parse error, the alternative options are printed out using the Bounded and Enum
instances.

* [#190] Add sumType combinator

* [#190] Add sum data type example to playground

* [#190] Add point about enumBounded error messages

Co-Authored-By: Dmitrii Kovanikov <kovanikov@gmail.com>

* [#190] More precise error message formatting

Co-Authored-By: Dmitrii Kovanikov <kovanikov@gmail.com>

* [#190] Name change from sumType to more precise enumBounded

* [#190] Clean up _EnumBounded type signatures

* [#190] Sidestep parsing text by using Map lookups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codec Conversion between TOML and custom user data types
Projects
None yet
Development

No branches or pull requests

2 participants