summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_repGuardOutput.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/th/TH_repGuardOutput.hs')
-rw-r--r--testsuite/tests/th/TH_repGuardOutput.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_repGuardOutput.hs b/testsuite/tests/th/TH_repGuardOutput.hs
new file mode 100644
index 0000000000..8335bf3231
--- /dev/null
+++ b/testsuite/tests/th/TH_repGuardOutput.hs
@@ -0,0 +1,29 @@
+-- test the representation of unboxed literals
+
+module Main
+where
+
+$(
+ [d|
+ foo :: Int -> Int
+ foo x
+ | x == 5 = 6
+ foo x = 7
+ |]
+ )
+
+$(
+ [d|
+ bar :: Maybe Int -> Int
+ bar x
+ | Just y <- x = y
+ bar _ = 9
+ |]
+ )
+
+main :: IO ()
+main = do putStrLn $ show $ foo 5
+ putStrLn $ show $ foo 8
+ putStrLn $ show $ bar (Just 2)
+ putStrLn $ show $ bar Nothing
+