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

add detail on parse error location and cause #210

Closed
wants to merge 595 commits into from

Conversation

zerobuzz
Copy link

This requires haskell/attoparsec#71 to have any impact, but it should work as well before with earlier attoparsecs.

basvandijk and others added 30 commits February 10, 2012 13:15
Fix module links in Haddock comments
They are just like decode and decode' respectively
but return an error message when decoding fails.
depends on text >= 0.11.1.0
Sometimes, it appears, Nullary constructors can be encoded as Null as
well as an empty array [not sure why one this!]. The Generic code, as of
49befca, fails when a Null is
passed for a nullary constructor. Add in a pattern match to fix this
issue.
Someone else released a version claiming to be 0.6.0.1 - boo!
Added an instance for the 'Fixed' class.
parseJSON for the variations on ISO-8601 dates as listed in ECMA-262.
Add functions for inspecting Values
Added eitherDecode and eitherDecode'
Add elaborate guide to Data.Aeson's Haddock documentation
basvandijk and others added 24 commits May 13, 2014 14:01
I think the latter is more descriptive.
I think the latter is more descriptive.

--HG--
extra : rebase_source : ccbcb71c7b8901da4d510f586c02ec5e9c411143
extra : histedit_source : 6db4361fc35e24c7649d96316cd3d4f9170e3a6b
--HG--
extra : rebase_source : f50acab7fd39d3e6ef22aeb91394b8bb73c238bb
extra : histedit_source : 504f28b4100ae2197e85c19fc1b14cab1ea72a51
--HG--
extra : rebase_source : 625058aecd476ec8f0140965e04787974ad21b70
extra : histedit_source : 13c9b34b80a918675cffa1311881b00b9e3511d5
--HG--
extra : amend_source : d48e612e53488f41b0d6f2ceb4395978b48d411d
--HG--
extra : amend_source : aa3ad961a2c62e2948ee0e213615c01ac002b42c
this requires attoparsec 0.12.2.0 or later to work
see haskell/attoparsec#71
@zerobuzz
Copy link
Author

(I am wondering how the attoparsec version dependency should be made obvious to everybody. I guess it would be neat to add a note to the error message iff attoparsec < 0.12.2 (is this easy to accomplish with CPP?). If there is any interest in this, I can write another pull request.)

Success a -> Right a
Error msg -> Left msg
L.Fail _ _ msg -> Left msg
case L.eitherResult $ L.parse p s of
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please drop the added translation here; it serves no useful purpose.

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure I understand -- do you mean I should drop the call to eitherResult entirely?

The point of thie change is that (given haskell/attoparsec#71 is merged) the <?>-comments will actually be shown. Without this change, they will be silently dropped. I've added another commit message to the attoparsec patch that explains this.

Copy link
Author

Choose a reason for hiding this comment

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

(i just stumbled back over this open browser tab, so i tried to replace the case with a >>=, and then i realized i didn't do that because Result and L.Result are two different types. So I think I need another hint.)

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.