summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_repPrim2.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/ghc86/TH_repPrim2.hs')
-rw-r--r--tests/examples/ghc86/TH_repPrim2.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/examples/ghc86/TH_repPrim2.hs b/tests/examples/ghc86/TH_repPrim2.hs
new file mode 100644
index 0000000..8ab2c84
--- /dev/null
+++ b/tests/examples/ghc86/TH_repPrim2.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE MagicHash, UnboxedTuples #-}
+{-# LANGUAGE TemplateHaskell #-}
+-- test the representation of unboxed literals
+
+module Main where
+
+import GHC.Exts
+import GHC.Float
+import Language.Haskell.TH
+import Text.PrettyPrint
+import System.IO
+
+main :: IO ()
+main = do putStrLn $ show $ $( do e <- [| 20# |]
+ runIO $ putStrLn $ show e
+ runIO $ putStrLn $ pprint e
+ runIO $ hFlush stdout
+ [| I# $( return e) |] )
+ putStrLn $ show $ $( do e <- [| 32## |]
+ runIO $ putStrLn $ show e
+ runIO $ putStrLn $ pprint e
+ runIO $ hFlush stdout
+ [| W# $(return e) |] )
+ putStrLn $ show $ $( do e <- [| 12.3# |]
+ runIO $ putStrLn $ show e
+ runIO $ putStrLn $ pprint e
+ runIO $ hFlush stdout
+ [| F# $(return e) |] )
+ putStrLn $ show $ $( do e <- [| 24.6## |]
+ runIO $ putStrLn $ show e
+ runIO $ putStrLn $ pprint e
+ runIO $ hFlush stdout
+ [| D# $(return e) |] )
+