GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:37:35Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/10091Add configurable verbosity level to hpc executable2019-07-07T18:37:35ZYurasAdd configurable verbosity level to hpc executableRight now `hpc markup` writes a notice for each module and for each index file:
```
Writing: Module.hs.html
Writing: hpc_index.html
Writing: hpc_index_fun.html
Writing: hpc_index_alt.html
Writing: hpc_index_exp.html
```
That is a bit a...Right now `hpc markup` writes a notice for each module and for each index file:
```
Writing: Module.hs.html
Writing: hpc_index.html
Writing: hpc_index_fun.html
Writing: hpc_index_alt.html
Writing: hpc_index_exp.html
```
That is a bit annoying when you have e.g. 100 modules.
I propose to add `--verbosity` flag with possible values `0`, `1` and `2` (default `1`) and suppress the notice for verbosity level `0`
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 7.8.4 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Code Coverage |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Add configurable verbosity level to hpc executable","status":"New","operating_system":"","component":"Code Coverage","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"Right now `hpc markup` writes a notice for each module and for each index file:\r\n\r\n{{{\r\nWriting: Module.hs.html\r\nWriting: hpc_index.html\r\nWriting: hpc_index_fun.html\r\nWriting: hpc_index_alt.html\r\nWriting: hpc_index_exp.html\r\n}}}\r\n\r\nThat is a bit annoying when you have e.g. 100 modules.\r\n\r\nI propose to add `--verbosity` flag with possible values `0`, `1` and `2` (default `1`) and suppress the notice for verbosity level `0`","type_of_failure":"OtherFailure","blocking":[]} -->7.10.1YurasYurashttps://gitlab.haskell.org/ghc/ghc/-/issues/9605Misleading error message with forgotten "do"2019-07-07T18:39:51ZowstMisleading error message with forgotten "do"In the following (simplified) code, I forgot to add the do keyword, when doing some refactoring. This caused GHC to give a strange error message that said approximately
"The function F is applied to two arguments, but its type T has only...In the following (simplified) code, I forgot to add the do keyword, when doing some refactoring. This caused GHC to give a strange error message that said approximately
"The function F is applied to two arguments, but its type T has only two"... which is odd!
```hs
import Control.Monad.RWS ( evalRWS, RWS )
import Control.Monad.Writer.Class ( tell )
main = print $ evalRWS (go 1) () ()
go :: Int -> RWS () [String] () ()
go i = --Oops, forgot a do here
return (show i) >>= (\l -> tell [l])
-- go $ i + 1
go i
```
Strangely, replacing the "go i" line with the commented-out line above it gives a sensible error message, the "Possible cause: \`\\l -\> tell \[l\]' is applied to too many arguments" message, which is correct, and would've pointed me straight to the problem.
The invalid error message, which appears to be the same using GHC 7.6.3 and 7.8.3, is:
```
NFA.hs:8:25:
Couldn't match type ‘String
-> Control.Monad.Trans.RWS.Lazy.RWST
() [String] () Data.Functor.Identity.Identity ()’
with ‘()’
Expected type: Int
-> String
-> Control.Monad.Trans.RWS.Lazy.RWST
() [String] () Data.Functor.Identity.Identity ()
Actual type: Int -> ()
The function ‘\ l -> tell [l]’ is applied to two arguments,
but its type ‘(Int -> RWS () [String] () ()) -> Int -> ()’
has only two
In the second argument of ‘(>>=)’, namely ‘(\ l -> tell [l]) go i’
In the expression: return (show i) >>= (\ l -> tell [l]) go i
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Misleading error message with forgotten \"do\"","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In the following (simplified) code, I forgot to add the do keyword, when doing some refactoring. This caused GHC to give a strange error message that said approximately\r\n\"The function F is applied to two arguments, but its type T has only two\"... which is odd!\r\n\r\n{{{#!hs\r\nimport Control.Monad.RWS ( evalRWS, RWS )\r\nimport Control.Monad.Writer.Class ( tell )\r\n\r\nmain = print $ evalRWS (go 1) () ()\r\n\r\ngo :: Int -> RWS () [String] () ()\r\ngo i = --Oops, forgot a do here\r\n return (show i) >>= (\\l -> tell [l])\r\n -- go $ i + 1\r\n go i\r\n}}}\r\n\r\nStrangely, replacing the \"go i\" line with the commented-out line above it gives a sensible error message, the \"Possible cause: `\\l -> tell [l]' is applied to too many arguments\" message, which is correct, and would've pointed me straight to the problem. \r\n\r\nThe invalid error message, which appears to be the same using GHC 7.6.3 and 7.8.3, is:\r\n\r\n{{{\r\nNFA.hs:8:25:\r\n Couldn't match type ‘String\r\n -> Control.Monad.Trans.RWS.Lazy.RWST\r\n () [String] () Data.Functor.Identity.Identity ()’\r\n with ‘()’\r\n Expected type: Int\r\n -> String\r\n -> Control.Monad.Trans.RWS.Lazy.RWST\r\n () [String] () Data.Functor.Identity.Identity ()\r\n Actual type: Int -> ()\r\n The function ‘\\ l -> tell [l]’ is applied to two arguments,\r\n but its type ‘(Int -> RWS () [String] () ()) -> Int -> ()’\r\n has only two\r\n In the second argument of ‘(>>=)’, namely ‘(\\ l -> tell [l]) go i’\r\n In the expression: return (show i) >>= (\\ l -> tell [l]) go i\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.10.1YurasYuras