summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Fixed.hs
diff options
context:
space:
mode:
authorSven Tennie <sven.tennie@gmail.com>2018-12-26 12:04:36 +0100
committerBen Gamari <ben@smart-cactus.org>2019-01-06 07:27:09 -0500
commit01b60b0e1ee57f882c5b729854343916c2295c51 (patch)
treebe1bfafd1e9a4dafc8c1a412b7c83fba3993b25a /libraries/base/Data/Fixed.hs
parentc121e33f9b039acf2ac6939af8bfafe593560039 (diff)
downloadhaskell-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.hs2
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