summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_recover.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/ghc86/TH_recover.hs')
-rw-r--r--tests/examples/ghc86/TH_recover.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/examples/ghc86/TH_recover.hs b/tests/examples/ghc86/TH_recover.hs
new file mode 100644
index 0000000..ac9c7cf
--- /dev/null
+++ b/tests/examples/ghc86/TH_recover.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+
+import Language.Haskell.TH
+
+-- The recover successfully find that 'ola' is not in scope
+-- and use '1' instead
+
+y = $(recover (return (LitE (IntegerL 1)))
+ (reify (mkName ("ola")) >> return (LitE (IntegerL 2))))
+
+main = print y
+