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

Function to print prettier parse exceptions #59

Merged
merged 5 commits into from Apr 19, 2015

Conversation

@Daniel-Diaz
Copy link
Contributor

commented Mar 31, 2015

Using yaml sometimes I find unpleasant to read parse exceptions produced by print. The function implemented in this PR tries to mitigate this. It is incomplete, but I wanted to know if the idea is worth before spending more time with it.

@snoyberg

This comment has been minimized.

Copy link
Owner

commented Mar 31, 2015

That's hilarious, I was just discussing this with @dysinger 3 hours ago. Yes, this is very much a desired feature. And with the new displayException method, we can make it even nicer for users of GHC 7.10.

@Daniel-Diaz

This comment has been minimized.

Copy link
Contributor Author

commented Mar 31, 2015

Oh, I forgot about the displayException method... I'll use that.

@snoyberg

This comment has been minimized.

Copy link
Owner

commented Mar 31, 2015

I'd recommend doing both a separate function and displayException, so that
users of older GHCs can still use it.

On Tue, Mar 31, 2015, 1:24 PM Daniel Díaz notifications@github.com wrote:

Oh, I forgot about the displayException method... I'll use that.


Reply to this email directly or view it on GitHub
#59 (comment).

@snoyberg

This comment has been minimized.

Copy link
Owner

commented Apr 6, 2015

Since I had another user asking about this, bumping. Are you still planning on implementing this?

Daniel-Diaz added 4 commits Apr 18, 2015
Make it compile with prettyPrintParseException, export this function …
…from Data.Yaml, and implement displayException for recent versions o base.
@Daniel-Diaz

This comment has been minimized.

Copy link
Contributor Author

commented Apr 18, 2015

My apologies. Travelling and work have kept me away from this.

I have included commits that finish implementing prettyPrintParseException, export it, and use it to implement displayException when compiling against base >= 4.8.0.0. I think YamlException can benefit from something like this too.

@Daniel-Diaz

This comment has been minimized.

Copy link
Contributor Author

commented Apr 18, 2015

Note that when showing a NonStringKeyAlias exception, it's using show with a value of type Value. This can get very ugly.

@Daniel-Diaz

This comment has been minimized.

Copy link
Contributor Author

commented Apr 18, 2015

Also, for the InvalidYaml case, a similar work for YamlException would make it look better. But I'd do that in a different PR.

snoyberg added a commit that referenced this pull request Apr 19, 2015
Merge pull request #59 from Daniel-Diaz/master
Function to print prettier parse exceptions

@snoyberg snoyberg merged commit f88b016 into snoyberg:master Apr 19, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@snoyberg

This comment has been minimized.

Copy link
Owner

commented Apr 19, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.