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

Parse exception raised for combination of .: and .!= #1110

Open
quintenkasteel opened this issue Jul 5, 2024 · 2 comments
Open

Parse exception raised for combination of .: and .!= #1110

quintenkasteel opened this issue Jul 5, 2024 · 2 comments

Comments

@quintenkasteel
Copy link

quintenkasteel commented Jul 5, 2024

We use aeson-1.4.7.1.

The following code raises an exception:

for the type:
data = Field {field :: Text}
field .: "fieldName" .!= "" raises an exception.

It would be great if this could raise an compile error instead.

@phadej
Copy link
Collaborator

phadej commented Jul 5, 2024

I don't understand. What you mean by raises an exception?

Please provide a complete reproducer.

@quintenkasteel
Copy link
Author

If i have a JSON record that looks like the following:
{ "fieldName": null }

If i use the parser: field .: "fieldName" .!= "" it will compile. But it will always raise an JSONConversionException:
"key "fieldName" not found"

I would like to get an compile error, as this code is not valid. The parser should use the parser for Maybe values:
field .:? "fieldName" .!= ""

I can code a minimal example if you need more clarification.

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

No branches or pull requests

2 participants