blob: d35292c5cdb9f1cf3a49d6996fad76426d0c29ca (
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
40
41
42
|
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}
import Language.Haskell.TH
class (a `C` b) c
$([d| data Foo a = Foo a deriving (y `C` z) |])
{-
Note: to debug
~/inplace/bin/ghc-stage2 --interactive
load the following
----------------------------------------
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-}
import Language.Haskell.TH
class (a `C` b) c
main :: IO ()
main
= putStrLn $([d| data Foo a = Foo a deriving (y `C` z) |] >>= stringE . show)
----------------------------------------
Bceomes
[DataD [] Foo_0 [PlainTV a_2 ()] Nothing
[NormalC Foo_1 [(Bang NoSourceUnpackedness NoSourceStrictness,VarT a_2)]]
[DerivClause Nothing
[AppT (AppT (ConT Main.C) (VarT y_6989586621679027885))
(VarT z_6989586621679027886)]]]
-}
|