summaryrefslogtreecommitdiff
path: root/libraries/base/tests/data-fixed-show-read.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/tests/data-fixed-show-read.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/tests/data-fixed-show-read.hs')
-rw-r--r--libraries/base/tests/data-fixed-show-read.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/tests/data-fixed-show-read.hs b/libraries/base/tests/data-fixed-show-read.hs
index 7e947f466e..8766f0ae0c 100644
--- a/libraries/base/tests/data-fixed-show-read.hs
+++ b/libraries/base/tests/data-fixed-show-read.hs
@@ -21,6 +21,10 @@ main = do doit 38.001
print (read "-38" :: Centi)
print (read "0.008" :: Fixed B7)
print (read "-0.008" :: Fixed B7)
+ print $ show (Just (-1 :: Milli))
+ print $ show (Just (1 :: Milli))
+ print ((read $ show (Just (-1 :: Deci))) :: Maybe Deci)
+ print ((read $ show (Just (1 :: Deci))) :: Maybe Deci)
doit :: Centi -> IO ()
doit c = do let s = show c