[GHC] #15326: Add option to disable error message expression context (the 'In the expression' things)

GHC ghc-devs at haskell.org
Sat Jun 30 16:31:45 UTC 2018


#15326: Add option to disable error message expression context (the 'In the
expression' things)
-------------------------------------+-------------------------------------
        Reporter:  dramforever       |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      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:                    |
-------------------------------------+-------------------------------------
Description changed by dramforever:

Old description:

> A typical error looks like this:
>
> {{{
> bug.hs:17:7: warning: [-Wdeferred-type-errors]
>     ? No instance for (PolyList t0 [Integer])
>         arising from a use of ‘polyList’
>     ? In the expression: polyList 1 2 3 4 5
>       In an equation for ‘plh’: plh = polyList 1 2 3 4 5
>    |
> 17 | plh = polyList 1 2 3 4 5
>    |       ^^^^^^^^^^^^^^^^^^
> }}}
>
> Note the two lines starting with `In`. They waste two lines of error
> message space and now provides near zero utility since:
>
> 1. There's a caret view right below that context.
> 2. There are editor integrations that show squiggles right in the editor.
>
> Now we have an option `-f[no-]diagnostics-show-caret` that disables the
> caret. It would be great to have one that disables those code context
> lines too.
>
> As for naming. I'm thinking about `-f[no-]diagnostics-show-context`,
> which may be confused with constraint contexts, and `-f[no-]diagnostics-
> show-code-context`, which is a bit too long. I don't really know what
> those context lines are properly called, so maybe someone can come up
> with a more precise one.

New description:

 A typical error looks like this:

 {{{
 bug.hs:17:7: warning: [-Wdeferred-type-errors]
     ? No instance for (PolyList t0 [Integer])
         arising from a use of ‘polyList’
     ? In the expression: polyList 1 2 3 4 5
       In an equation for ‘plh’: plh = polyList 1 2 3 4 5
    |
 17 | plh = polyList 1 2 3 4 5
    |       ^^^^^^^^^^^^^^^^^^
 }}}

 Note the two lines starting with `In`. They waste two lines of error
 message space and now provides near zero utility since:

 1. There's a caret view right below that context.
 2. There are editor integrations that show squiggles right in the editor.

 Now we have an option `-f[no-]diagnostics-show-caret` that disables the
 caret. It would be great to have one that disables those code context
 lines too.

 This would make code errors shorter and easier to scroll through and read.
 And in editor integration, this would make the, say, error message popup
 less of a 'wall of text'.

 As for naming. I'm thinking about `-f[no-]diagnostics-show-context`, which
 may be confused with constraint contexts, and `-f[no-]diagnostics-show-
 code-context`, which is a bit too long. I don't really know what those
 context lines are properly called, so maybe someone can come up with a
 more precise one.

--

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15326#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list