GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:32:17Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/11064Call Arity has the trivial application case wrong2019-07-07T18:32:17ZJoachim Breitnermail@joachim-breitner.deCall Arity has the trivial application case wrongIn `e x`, the result of `x` is not shared in contrast to `e (f x)`, where CorePrep will turn it into `let y = f x in e x`. So in
```
let f = ...
in e (f x)
```
we know that f is called at most once, but in
```
let f = ...
in e...In `e x`, the result of `x` is not shared in contrast to `e (f x)`, where CorePrep will turn it into `let y = f x in e x`. So in
```
let f = ...
in e (f x)
```
we know that f is called at most once, but in
```
let f = ...
in e f
```
we do not know that.
Previously Call Arity would assume that in `e x`, `x` is evaluated at
most once. This rarely would make a difference (the argument `x` is
analized with an incoming arity of 0, so no eta-expansion would be done
anyways), but of course this should still be fixed.
I just validated a patch and will push shortly.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.2 |
| 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":"Call Arity has the trivial application case wrong","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"nomeata"},"version":"7.10.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"In `e x`, the result of `x` is not shared in contrast to `e (f x)`, where CorePrep will turn it into `let y = f x in e x`. So in\r\n{{{\r\n let f = ...\r\n in e (f x)\r\n}}}\r\nwe know that f is called at most once, but in\r\n{{{\r\n let f = ...\r\n in e f\r\n}}}\r\nwe do not know that.\r\n\r\nPreviously Call Arity would assume that in `e x`, `x` is evaluated at\r\nmost once. This rarely would make a difference (the argument `x` is\r\nanalized with an incoming arity of 0, so no eta-expansion would be done\r\nanyways), but of course this should still be fixed.\r\n\r\nI just validated a patch and will push shortly.","type_of_failure":"OtherFailure","blocking":[]} -->7.10.3Joachim Breitnermail@joachim-breitner.deJoachim Breitnermail@joachim-breitner.de