summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_repGuardOutput.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/ghc86/TH_repGuardOutput.hs')
-rw-r--r--tests/examples/ghc86/TH_repGuardOutput.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/examples/ghc86/TH_repGuardOutput.hs b/tests/examples/ghc86/TH_repGuardOutput.hs
new file mode 100644
index 0000000..0f02324
--- /dev/null
+++ b/tests/examples/ghc86/TH_repGuardOutput.hs
@@ -0,0 +1,30 @@
+-- test the representation of unboxed literals
+{-# LANGUAGE TemplateHaskell #-}
+
+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
+