summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T2222.hs
blob: 7b5be7868ef69ad0829a3f12a70f6817554bc669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

{-# LANGUAGE TemplateHaskell #-}
module ReifyPlusTypeInferenceBugs where

import Language.Haskell.TH
import System.IO

a = 1

$(return [])

b = $(do VarI _ t _ <- reify 'a
         runIO $ putStrLn ("inside b: " ++ pprint t)
         [| undefined |]) 

c = $([| True |])

$(return [])

d = $(do VarI _ t _ <- reify 'c
         runIO $ putStrLn ("inside d: " ++ pprint t)
         [| undefined |] )

$(do VarI _ t _ <- reify 'c
     runIO $ putStrLn ("type of c: " ++ pprint t)
     return [] )

e = $([| True |])

$(return [])

f = $(do VarI _ t _ <- reify 'e
         runIO $ putStrLn ("inside f: " ++ pprint t)
         [| undefined |] )

$(do VarI _ t _ <- reify 'e
     runIO $ putStrLn ("type of e: " ++ pprint t)
     return [] )

$( runIO $ do hFlush stdout
              hFlush stderr
              return [] )