summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_reifyExplicitForAllFams.hs
blob: 60a6d4563ffff995394aaae32d56065552a7895d (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
-- test reification of explicit foralls in type families

{-# LANGUAGE TypeFamilies, ExplicitForAll #-}
module TH_reifyExplicitForAllFams where

import System.IO
import Language.Haskell.TH
import Text.PrettyPrint.HughesPJ

import Data.Proxy
import Data.Kind

$([d| data family F a
      data instance forall a. F (Maybe a) = MkF a |])

$([d| class C a where
        type G a b
      instance forall a. C [a] where
        type forall b. G [a] b = Proxy b |])

$([d| type family H a b where
        forall x y. H [x] (Proxy y) = Either x y
        forall z.   H z   z         = Maybe z |])

$(return [])

test :: ()
test = $(let
      display :: Name -> Q ()
      display q = do { i <- reify q; runIO $ hPutStrLn stderr (pprint i) }
    in do { display ''F
          ; display ''C
          ; display ''G
          ; display ''H
          ; [| () |] })