Show instance for Data.Fixed does not show parentheses for negatives
When showing negative numbers most types emit parentheses in precedence level 11 because the result is not atomic:
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
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.
Trac metadata
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 |