[GHC] #11014: re-order GHC type errors for clarity

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 7.11 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Here's a typical simple type error from GHC: {{{#!hs Derive/Call/India/Pakhawaj.hs:142:62: Couldn't match type ‘Text’ with ‘(a1, Syllable)’ Expected type: [([(a1, Syllable)], [Sequence Bol])] Actual type: [([Syllable], [Sequence Bol])] Relevant bindings include syllables :: [(a1, Syllable)] (bound at Derive/Call/India/Pakhawaj.hs:141:16) best_match :: [(a1, Syllable)] -> Maybe (Int, ([(a1, Syllable)], [(a1, Sequence Bol)])) (bound at Derive/Call/India/Pakhawaj.hs:141:5) In the second argument of ‘mapMaybe’, namely ‘all_bols’ In the second argument of ‘($)’, namely ‘mapMaybe (match_bols syllables) all_bols’ }}} The order of sections is "couldn't match", "expected actual", "relevant bindings", "context" (in the second argument etc.). I think it would be easier to read as "couldn't match", "expected actual", "context", "bindings", and with a * to mark each section: {{{#!hs Derive/Call/India/Pakhawaj.hs:142:62: * Couldn't match type ‘Text’ with ‘(a1, Syllable)’ Expected type: [([(a1, Syllable)], [Sequence Bol])] Actual type: [([Syllable], [Sequence Bol])] * In the second argument of ‘mapMaybe’, namely ‘all_bols’ In the second argument of ‘($)’, namely ‘mapMaybe (match_bols syllables) all_bols’ * Relevant bindings include syllables :: [(a1, Syllable)] (bound at Derive/Call/India/Pakhawaj.hs:141:16) best_match :: [(a1, Syllable)] -> Maybe (Int, ([(a1, Syllable)], [(a1, Sequence Bol)])) (bound at Derive/Call/India/Pakhawaj.hs:141:5) }}} I'm sure there are plenty of other sections that don't show up in this simple example, in any case they should go from most to least critical and be marked off with a *. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): Just checking: Is this something you’d like to work on yourself, and turn into a patch? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * failure: None/Unknown => Incorrect warning at compile-time Comment: Also discussed in this thread: https://mail.haskell.org/pipermail/glasgow- haskell-users/2015-October/026066.html. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by elaforge): Yeah, I'm working on a patch. I'll update the ticket once I get all the details figured out. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1427 Wiki Page: | -------------------------------------+------------------------------------- Changes (by elaforge): * differential: => Phab:D1427 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity
-------------------------------------+-------------------------------------
Reporter: elaforge | Owner: elaforge
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1427
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1427 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: This has been merged. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: elaforge Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1427 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Evan, thank you for doing this. I think it's a step forward. I failed to review your patch in a timely way, but I've now had a quick look. Some questions * The Monoid instance of `Report` is suspicious. Do you ''really'' merge two separate reports, combining their important and relevant-bindings stuff? Of course not! Rather, you use it exclusively to combine a degenerate report with only 'important' stuff and another degenerate report with only 'supplementary' stuff. This seems confusing and indirect. Instead of {{{ let report = important given_msg `mappend` relevant_bindings binds_msg }}} why not say {{{ let report = mkReport given_msg binds_msg }}} and drop the suspicious Monoid instance. * It will not have escaped your attention that `TcErrors.Report` and `ErrUtils.ErrDoc` are virtually identical. Could you perhaps just combine them? To get the `errDocContext` you could either (I suppose) start with it empty, and add it; or make `mkReport` monadic (better probably). * I'd love you to do as you suggest and get rid of `errMsgShortString`. * Are you sure you need to filter out empty docs? Can't you just avoid putting empty docs into the [SDoc] in the first place? Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11014: re-order GHC type errors for clarity -------------------------------------+------------------------------------- Reporter: elaforge | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1427 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: closed => new * owner: elaforge => * resolution: fixed => Comment: PS: I'll re-open to track progress -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11014#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC