Skip to content

Function to print prettier parse exceptions - #59

Merged
snoyberg merged 5 commits into
snoyberg:masterfrom
Daniel-Diaz:master
Apr 19, 2015
Merged

Function to print prettier parse exceptions#59
snoyberg merged 5 commits into
snoyberg:masterfrom
Daniel-Diaz:master

Conversation

@Daniel-Diaz

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Author

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

@snoyberg

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

snoyberg commented Apr 6, 2015

Copy link
Copy Markdown
Owner

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

@Daniel-Diaz

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants