Commit 6ef11e54 authored by Ian Lynagh's avatar Ian Lynagh

Add a test that checks pretty-printed TH output looks right

parent 0973c325
module Main (main) where
import Language.Haskell.TH
u1 :: a
u1 = undefined
u2 :: a
u2 = undefined
f :: a
f = undefined
(.+.) :: a
(.+.) = undefined
main :: IO ()
main = do runQ [| f u1 u2 |] >>= p
runQ [| u1 `f` u2 |] >>= p
runQ [| (.+.) u1 u2 |] >>= p
runQ [| u1 .+. u2 |] >>= p
runQ [| (:) u1 u2 |] >>= p
runQ [| u1 : u2 |] >>= p
runQ [| \((:) x xs) -> x |] >>= p
runQ [| \(x : xs) -> x |] >>= p
runQ [d| class Foo a b where
foo :: a -> b |] >>= p
p :: Ppr a => a -> IO ()
p = putStrLn . pprint
Main.f Main.u1 Main.u2
Main.u1 `Main.f` Main.u2
(Main..+.) Main.u1 Main.u2
Main.u1 Main..+. Main.u2
(GHC.Base.:) Main.u1 Main.u2
Main.u1 GHC.Base.: Main.u2
\((GHC.Base.:) x_0 xs_1) -> x_0
\(x_0 GHC.Base.: xs_1) -> x_0
class Foo a_0 b_1
where foo :: a_0 -> b_1
......@@ -73,3 +73,5 @@ test('TH_exn', normal, compile_fail, [''])
test('TH_recover', normal, compile_and_run, [''])
test('TH_dataD1', normal, compile_fail, ['-v0'])
test('TH_ppr1', normal, compile_and_run, ['-fglasgow-exts'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment