GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2020-12-18T15:20:30Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/13600surprising error message with bang pattern2020-12-18T15:20:30ZAndrew U. Franksurprising error message with bang patternthe following code
```
f3 :: [Int] -> IO Int
f3 x = return (sum x)
f4 :: [Int] -> IO Int
f4 !x = return (sum x)
```
gives `The type signature for ‘f4’ lacks an accompanying binding` for the second function (the two functions are...the following code
```
f3 :: [Int] -> IO Int
f3 x = return (sum x)
f4 :: [Int] -> IO Int
f4 !x = return (sum x)
```
gives `The type signature for ‘f4’ lacks an accompanying binding` for the second function (the two functions are exactly the same except for the added bang). I do not understand bang patterns well, but would expect a more instructive error message. without the type definition, the second function f4 compiles with the bang).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Linux |
| Architecture | x86_64 (amd64) |
</details>
<!-- {"blocked_by":[],"summary":"surprising error message with bang pattern","status":"New","operating_system":"Linux","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"x86_64 (amd64)","cc":[""],"type":"Bug","description":"the following code \r\n\r\n{{{\r\nf3 :: [Int] -> IO Int \r\nf3 x = return (sum x) \r\n\r\nf4 :: [Int] -> IO Int \r\nf4 !x = return (sum x) \r\n}}}\r\n\r\ngives `The type signature for ‘f4’ lacks an accompanying binding` for the second function (the two functions are exactly the same except for the added bang). I do not understand bang patterns well, but would expect a more instructive error message. without the type definition, the second function f4 compiles with the bang). ","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Sasha Bogicevicsasa.bogicevic@pm.meSasha Bogicevicsasa.bogicevic@pm.me