-
Notifications
You must be signed in to change notification settings - Fork 68
Error handling #273
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
Error handling #273
Conversation
- Omit unnecessary show-invocation - Use showOutputable for the error span (location) before/after: "RealSrcSpan SrcSpanPoint \"stdin\" 2 1: parse error (possibly incorrect indentation or mismatched brackets)" stdin:2:1: parse error (possibly incorrect indentation or mismatched brackets)
|
@lspitzner could you add a bit more color to this? What about this makes it more pleasant? Maybe some examples? |
|
eh, sure: Take Test.hs {-# LANGUAGE TemplateHaskell #-}
main = do
print 42
myTh = [t|Maybe
Int|]Previous behaviour> command/stdin with this PRThe behaviour is roughly "take each top-level module element, pass it through |
|
But the granularity is really the top-level module elements; if you have {-# LANGUAGE TemplateHaskell #-}
func = 42
where
cantbeformatted = [t|Maybe
Int|]then it says "somewhere in the |
|
Thanks! Agreed this is much nicer behavior. |
tfausak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
|
Thanks for the feedback. After testing with multiple inputs, I got sidetracked thinking about proper exit codes for warnings. But this PR certainly does not make this any worse (we just now a few more instances of exit-code-0 plus warnings on stderr). And I think that is the right choice anyway. Merging, finally. |
This turned out to be a rather simple change that might make brittany usage a good bit more pleasant if you use any yet-unsupported stuff (TemplateHaskell comes to mind).
Could need a review/a bit more manual testing, as I don't think the test suite would catch a problem here.