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

Allow boundedEnum to accept a parameter to modify text beforehand #25

Closed
wants to merge 1 commit into from

Conversation

OwenGraves
Copy link
Contributor

This let's us handle an enum where the input text may not exactly match the toText values but can be converted to them (such as converting to lower case values).

This let's us handle an enum where the input text may not exactly match the toText
values but can be converted to them (such as converting to lower case values).
@@ -154,7 +154,7 @@ instance FC.Fleece Decoder where
Decoder name $
Aeson.withObject (FC.nameToString name) parseObject

boundedEnumNamed name toText =
boundedEnumNamedModifyText name toText modifyText =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd like to handle this a different way.

@ysangkok
Copy link
Contributor

I'd like to note that this wouldn't be necessary if we made boundedEnum non-type-class based, because then I imagine that you could wrap the converter functions passed into that hypothetical schema with T.toLower...

@OwenGraves
Copy link
Contributor Author

Closing as this is probably better handled as a enum utility function in a different library

@OwenGraves OwenGraves closed this Feb 23, 2024
@OwenGraves OwenGraves deleted the owen/enum-modify-text branch August 6, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants