summaryrefslogtreecommitdiff
path: root/libraries/base/tests/data-fixed-show-read.stdout
Commit message (Collapse)AuthorAgeFilesLines
* Fix precedence handling for Data.Fixed's Show instance (#16031)Sven Tennie2019-01-061-0/+4
| | | | | Use `showsPrec` instead of `show` to respect the precedence of the surrounding context.
* Make `read . show = id` for Data.Fixed (fix #9240)Brian McKenna2014-12-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QuickCheck property now succeeds: prop :: Fixed B7 -> Bool prop a = read (show a) == a This changes the Show instance for Fixed to round up, rather than down when calculating a digit. This needs to happen because Read also rounds down: data B7 instance HasResolution B7 where resolution _ = 128 1 / 128 = 0.0078125 read "0.007" = (0.000 :: Fixed B7) Here is an example of the change to Show: showFixed False (0.009 :: Fixed B7) -- Broken: "0.007" -- Fixed: "0.008" And now Read can continue to round down: read "0.008" = (0.0078125 :: Fixed B7) Reviewed By: hvr, ekmett Differential Revision: https://phabricator.haskell.org/D547
* Move testsuite/tests/lib/Data.Fixed test to base/testsIan Lynagh2011-11-191-0/+18