summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/T10891.hs
blob: d91caf94f6a3a21d1da94039ae290be54a319148 (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
{-# LANGUAGE TypeFamilies #-}

module T10891 where

import Language.Haskell.TH
import System.IO

class C a where
  f :: a -> Int

class C' a where
  type F a :: *
  type F a = a
  f' :: a -> Int

class C'' a where
  data Fd a :: *

instance C' Int where
  type F Int = Bool
  f' = id

instance C'' Int where
  data Fd Int = B Bool | C Char

$(return [])

test :: ()
test =
  $(let
      display :: Name -> Q ()
      display q = do
        i <- reify q
        runIO (hPutStrLn stderr (pprint i) >> hFlush stderr)
    in do
      display ''C
      display ''C'
      display ''C''
      [| () |])