summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/TH_ppr1.hs
blob: 668ae3c6fa0b4370cd82d8cc0b00b5f1e795fc9c (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
{-# 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