GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:01:57Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/16031Show instance for Data.Fixed does not show parentheses for negatives2019-07-07T18:01:57ZSteven KeuchelShow instance for Data.Fixed does not show parentheses for negativesWhen showing negative numbers most types emit parentheses in precedence level 11 because the result is not atomic:
```hs
GHCi, version 8.7.20181015: http://www.haskell.org/ghc/ :? for help
Prelude> show (Just (-1 :: Int))
"Just (-1)"
P...When showing negative numbers most types emit parentheses in precedence level 11 because the result is not atomic:
```hs
GHCi, version 8.7.20181015: http://www.haskell.org/ghc/ :? for help
Prelude> show (Just (-1 :: Int))
"Just (-1)"
Prelude> show (Just (-1 :: Float))
"Just (-1.0)"
```
However, the Show instance for Fixed does not
```hs
Prelude> :m Data.Fixed
Prelude Data.Fixed> show (Just (-1 :: Fixed E2))
"Just -1.00"
Prelude Data.Fixed>
```
I would expect it to, because of consistency and because the result "Just -1.00" is ill-typed when seen as an expression.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Show instance for Data.Fixed does not show parentheses for negatives","status":"New","operating_system":"","component":"libraries/base","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":["Data.Fixed,","Show"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When showing negative numbers most types emit parentheses in precedence level 11 because the result is not atomic: \r\n\r\n{{{#!hs\r\nGHCi, version 8.7.20181015: http://www.haskell.org/ghc/ :? for help\r\nPrelude> show (Just (-1 :: Int))\r\n\"Just (-1)\"\r\nPrelude> show (Just (-1 :: Float))\r\n\"Just (-1.0)\"\r\n}}}\r\n\r\nHowever, the Show instance for Fixed does not\r\n\r\n{{{#!hs\r\nPrelude> :m Data.Fixed\r\nPrelude Data.Fixed> show (Just (-1 :: Fixed E2))\r\n\"Just -1.00\"\r\nPrelude Data.Fixed> \r\n}}}\r\n\r\nI would expect it to, because of consistency and because the result \"Just -1.00\" is ill-typed when seen as an expression.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Sven TennieSven Tennie