blob: f242144404c1fb19376dca0cd2d1a2d8fa170c86 (
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
|
{-# LANGUAGE Haskell2010 #-}
-- 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
; [| () |] })
|