summaryrefslogtreecommitdiff
path: root/tests/examples/ghc88/TH_recursiveDoImport.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/ghc88/TH_recursiveDoImport.hs')
-rwxr-xr-xtests/examples/ghc88/TH_recursiveDoImport.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/examples/ghc88/TH_recursiveDoImport.hs b/tests/examples/ghc88/TH_recursiveDoImport.hs
new file mode 100755
index 0000000..ce30338
--- /dev/null
+++ b/tests/examples/ghc88/TH_recursiveDoImport.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE RecursiveDo #-}
+{-# LANGUAGE TemplateHaskell #-}
+module TH_recursiveDoImport where
+import Data.IORef
+import Language.Haskell.TH
+
+data SelfRef = SelfRef (IORef (IORef SelfRef))
+
+recIO :: ExpQ
+recIO = [e|
+ do rec r1 <- newIORef r2
+ r2 <- newIORef (SelfRef r1)
+ readIORef r2 |]
+
+mdoIO :: ExpQ
+mdoIO = [e|
+ mdo r1 <- return r2
+ r2 <- return (const 1 r1)
+ return r1 |]
+
+emptyRecIO :: ExpQ
+emptyRecIO = [e|
+ do rec {}
+ return () |]
+