T2222.hs 788 Bytes
Newer Older
ian@well-typed.com's avatar
ian@well-typed.com committed
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

{-# LANGUAGE TemplateHaskell #-}
module ReifyPlusTypeInferenceBugs where

import Language.Haskell.TH
import System.IO

a = 1

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

c = $([| True |])

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 |])

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 [] )