diff options
author | Sven Tennie <sven.tennie@gmail.com> | 2018-12-26 12:04:36 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-01-06 07:27:09 -0500 |
commit | 01b60b0e1ee57f882c5b729854343916c2295c51 (patch) | |
tree | be1bfafd1e9a4dafc8c1a412b7c83fba3993b25a /libraries/base/Data/Fixed.hs | |
parent | c121e33f9b039acf2ac6939af8bfafe593560039 (diff) | |
download | haskell-01b60b0e1ee57f882c5b729854343916c2295c51.tar.gz |
Fix precedence handling for Data.Fixed's Show instance (#16031)
Use `showsPrec` instead of `show` to respect the precedence of the surrounding
context.
Diffstat (limited to 'libraries/base/Data/Fixed.hs')
-rw-r--r-- | libraries/base/Data/Fixed.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries/base/Data/Fixed.hs b/libraries/base/Data/Fixed.hs index 98acb76967..482ec0a694 100644 --- a/libraries/base/Data/Fixed.hs +++ b/libraries/base/Data/Fixed.hs @@ -158,7 +158,7 @@ showFixed chopTrailingZeros fa@(MkFixed a) = (show i) ++ (withDot (showIntegerZe -- | @since 2.01 instance (HasResolution a) => Show (Fixed a) where - show = showFixed False + showsPrec p n = showParen (p > 6 && n < 0) $ showString $ showFixed False n -- | @since 4.3.0.0 instance (HasResolution a) => Read (Fixed a) where |