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

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
Copy link
Owner

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
Copy link
Contributor Author

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

@snoyberg
Copy link
Owner

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
Copy link
Owner

snoyberg commented Apr 6, 2015

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

@Daniel-Diaz
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@Daniel-Diaz
Copy link
Contributor Author

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
Function to print prettier parse exceptions
@snoyberg snoyberg merged commit f88b016 into snoyberg:master Apr 19, 2015
@snoyberg
Copy link
Owner

Thanks!

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.

None yet

2 participants