diff options
Diffstat (limited to 'libraries/base/tests/T19719.hs')
-rw-r--r-- | libraries/base/tests/T19719.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libraries/base/tests/T19719.hs b/libraries/base/tests/T19719.hs new file mode 100644 index 0000000000..613f92ad6c --- /dev/null +++ b/libraries/base/tests/T19719.hs @@ -0,0 +1,26 @@ +module Main (main) where + +import Data.Complex (Complex(..)) +import Data.Functor.Classes (readPrec1, showsPrec1) +import Text.ParserCombinators.ReadPrec (readPrec_to_S) +import Text.Read (Read(..)) + +comp :: Complex Int +comp = 1 :+ 1 + +compareInstances :: Int -> IO () +compareInstances p = do + let precBanner = " (at precedence " ++ show p ++ ")" + putStrLn $ "Read vs. Read1" ++ precBanner + print (readPrec_to_S readPrec p "1 :+ 1" :: [(Complex Int, String)]) + print (readPrec_to_S readPrec1 p "1 :+ 1" :: [(Complex Int, String)]) + putStrLn "" + putStrLn $ "Show vs. Show1" ++ precBanner + putStrLn $ showsPrec p comp "" + putStrLn $ showsPrec1 p comp "" + putStrLn "" + +main :: IO () +main = do + compareInstances 6 + compareInstances 7 |