diff options
Diffstat (limited to 'testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs')
-rw-r--r-- | testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs b/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs new file mode 100644 index 0000000000..349f639f2c --- /dev/null +++ b/testsuite/tests/lib/Data.Fixed/data-fixed-show-read.hs @@ -0,0 +1,22 @@ + +module Main (main) where + +import Data.Fixed + +main :: IO () +main = do doit 38.001 + doit 38.009 + doit 38.01 + doit 38.09 + print (read "38" :: Centi) + doit (-38.001) + doit (-38.009) + doit (-38.01) + doit (-38.09) + print (read "-38" :: Centi) + +doit :: Centi -> IO () +doit c = do let s = show c + r = read s :: Centi + putStrLn s + print r |