blob: f193cf708863583f22303591b3aaacf240736bb9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
|