[GHC] #10021: Add "Error:" prefix for compile-time error messages (was: Add "Error:" prefix for error-messages)
GHC
ghc-devs at haskell.org
Wed Jan 28 11:43:15 UTC 2015
#10021: Add "Error:" prefix for compile-time error messages
-------------------------------------+-------------------------------------
Reporter: k-bx | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 7.12.1
Component: Compiler | Version: 7.8.4
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by k-bx:
Old description:
> Similar to what we have for "Warning:".
>
> E.g., we have:
>
> {{{
> ➜ cat test.hs
> main = putStrLn "Hello!"
> ➜ ghc --make -fforce-recomp -Wall ./test.hs
> [1 of 1] Compiling Main ( test.hs, test.o )
>
> test.hs:1:1: Warning:
> Top-level binding with no type signature: main :: IO ()
> Linking test ...
> ➜ cat test2.hs
> main = foo
> ➜ ghc --make -fforce-recomp -Wall ./test2.hs
> [1 of 1] Compiling Main ( test2.hs, test2.o )
>
> test2.hs:1:8: Not in scope: ‘foo’
> }}}
>
> And I propose having:
>
> {{{
> ➜ cat test2.hs
> main = foo
> ➜ ghc --make -fforce-recomp -Wall ./test2.hs
> [1 of 1] Compiling Main ( test2.hs, test2.o )
>
> test2.hs:1:8: Error: Not in scope: ‘foo’
> }}}
>
> This proposal only affects error messages produced by GHC itself. For
> example, the behaviour of the `error` function is unaffected.
>
> == Motivation ==
>
> Main motivation point right now is that there's a ticket #9219 (parallel
> build's output of errors doesn't occur at the end of output), due to
> which, error-reporting of your program might get lost somewhere in the
> middle of a build-log. As another example, if your program has a lot of
> warnings, and you build it with multiple cores, you almost always get an
> error lost somewhere in the middle of warnings and it's almost impossible
> to find.
>
> So, this feature's main purpose is to ease navigation in textual output
> of ghc in order to find errors quickly, not being tied to output
> ordering.
>
> == Disadvantages ==
>
> Many regression tests might need a fix.
New description:
The proposal is to modify GHC compile-time output for error-messages, by
adding a prefix, similar to what we currently have for warnings.
An example of a warning message (see `Warning:` prefix):
{{{
➜ cat test.hs
main = putStrLn "Hello!"
➜ ghc --make -fforce-recomp -Wall ./test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
test.hs:1:1: Warning:
Top-level binding with no type signature: main :: IO ()
Linking test ...
}}}
An example of current output for an error:
{{{
➜ cat test2.hs
main = foo
➜ ghc --make -fforce-recomp -Wall ./test2.hs
[1 of 1] Compiling Main ( test2.hs, test2.o )
test2.hs:1:8: Not in scope: ‘foo’
}}}
The proposal is to change it to become:
{{{
➜ cat test2.hs
main = foo
➜ ghc --make -fforce-recomp -Wall ./test2.hs
[1 of 1] Compiling Main ( test2.hs, test2.o )
test2.hs:1:8: Error: Not in scope: ‘foo’
}}}
This proposal only affects error messages produced by GHC itself. For
example, the behaviour of the `error` function is unaffected.
== Motivation ==
Main motivation point right now is that there's a ticket #9219 (parallel
build's output of errors doesn't occur at the end of output), due to
which, error-reporting of your program might get lost somewhere in the
middle of a build-log. As another example, if your program has a lot of
warnings, and you build it with multiple cores, you almost always get an
error lost somewhere in the middle of warnings and it's almost impossible
to find.
So, this feature's main purpose is to ease navigation in textual output of
ghc in order to find errors quickly, not being tied to output ordering.
== Disadvantages ==
Many regression tests might need a fix.
== Additional consideration ==
@hvr proposed that during work on this bug we could make GHC output more
consistent with other compiler's (GCC and clang) by also lower-casing
"Error" and "Warning" prefixes.
This might be potentially useful for existing tools that work on top of
compiler output for finding errors/warning, and GHC's output will become
"more valid" for them.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10021#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list