summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_repUnboxedTuples.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/th/TH_repUnboxedTuples.hs')
-rw-r--r--testsuite/tests/th/TH_repUnboxedTuples.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_repUnboxedTuples.hs b/testsuite/tests/th/TH_repUnboxedTuples.hs
new file mode 100644
index 0000000000..30b6a5e2a8
--- /dev/null
+++ b/testsuite/tests/th/TH_repUnboxedTuples.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE TemplateHaskell, UnboxedTuples #-}
+-- test the representation of unboxed tuples
+
+module Main where
+
+import GHC.Exts
+import GHC.Float
+import Language.Haskell.TH
+import Text.PrettyPrint
+import System.IO
+
+main :: IO ()
+main = case bar () of
+ (# str, int #) ->
+ print (str, int)
+
+bar :: () -> (# String, Int #)
+bar () = $( do e <- [| case (# 'b', False #) of
+ (# 'a', True #) -> (# "One", 1 #)
+ (# 'b', False #) -> (# "Two", 2 #)
+ (# _, _ #) -> (# "Three", 3 #)
+ |]
+ runIO $ putStrLn $ show e
+ runIO $ putStrLn $ pprint e
+ runIO $ hFlush stdout
+ return e )
+