summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_ppr1.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/examples/ghc86/TH_ppr1.hs')
-rw-r--r--tests/examples/ghc86/TH_ppr1.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/examples/ghc86/TH_ppr1.hs b/tests/examples/ghc86/TH_ppr1.hs
new file mode 100644
index 0000000..668ae3c
--- /dev/null
+++ b/tests/examples/ghc86/TH_ppr1.hs
@@ -0,0 +1,38 @@
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TemplateHaskell #-}
+
+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
+ runQ [| \x -> (x, 1 `x` 2) |] >>= p
+ runQ [| \(+) -> ((+), 1 + 2) |] >>= p
+ runQ [| (f, 1 `f` 2) |] >>= p
+ runQ [| ((.+.), 1 .+. 2) |] >>= p
+
+p :: Ppr a => a -> IO ()
+p = putStrLn . pprint
+