summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_recursiveDo.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/th/TH_recursiveDo.hs')
-rw-r--r--testsuite/tests/th/TH_recursiveDo.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_recursiveDo.hs b/testsuite/tests/th/TH_recursiveDo.hs
new file mode 100644
index 0000000000..f193cf7088
--- /dev/null
+++ b/testsuite/tests/th/TH_recursiveDo.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE RecursiveDo #-}
+import Data.IORef
+import Language.Haskell.TH
+import Language.Haskell.TH.Syntax
+import TH_recursiveDoImport
+
+main = testRec >> testMdo
+
+testRec = do
+ putStrLn $(lift . pprint =<< recIO)
+ -- Test that we got the expected structure.
+ SelfRef r1 <- $(recIO)
+ r2 <- readIORef r1
+ SelfRef r1' <- readIORef r2
+ print (r1 == r1')
+
+testMdo =
+ putStrLn $(lift . pprint =<< mdoIO)