diff options
author | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2015-11-11 10:49:22 +0100 |
---|---|---|
committer | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2015-12-21 20:47:16 +0100 |
commit | eeecb8647585ad9eea0554b2f97a3645d2c59f88 (patch) | |
tree | d2294dd80400f495deab260e4e810b7dcbefb096 /testsuite/tests/overloadedrecflds | |
parent | a61e717fcff9108337b1d35783ea3afbf591d3c6 (diff) | |
download | haskell-eeecb8647585ad9eea0554b2f97a3645d2c59f88.tar.gz |
Add proper GADTs support to Template Haskell
Until now GADTs were supported in Template Haskell by encoding them using
normal data types. This patch adds proper support for representing GADTs
in TH.
Test Plan: T10828
Reviewers: goldfire, austin, bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D1465
GHC Trac Issues: #10828
Diffstat (limited to 'testsuite/tests/overloadedrecflds')
-rw-r--r-- | testsuite/tests/overloadedrecflds/should_fail/T11103.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/T11103.hs b/testsuite/tests/overloadedrecflds/should_fail/T11103.hs index 2ba8e41a22..2791dc4fca 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/T11103.hs +++ b/testsuite/tests/overloadedrecflds/should_fail/T11103.hs @@ -12,7 +12,7 @@ data S = MkS { foo :: Int } $(do info <- reify ''R case info of - TyConI (DataD _ _ _ [RecC _ [(foo_n, _, _), (bar_n, _, _)]] _) + TyConI (DataD _ _ _ _ [RecC _ [(foo_n, _, _), (bar_n, _, _)]] _) -> do { reify bar_n -- This is unambiguous ; reify foo_n -- This is ambiguous ; return [] diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs b/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs index e70c5db7b1..e97fdcea9a 100644 --- a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs +++ b/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs @@ -6,7 +6,8 @@ import Language.Haskell.TH import Language.Haskell.TH.Syntax -- Splice in a datatype with field... -$(return [DataD [] (mkName "R") [] [RecC (mkName "MkR") [(mkName "foo", NotStrict, ConT ''Int)]] []]) +$(return [DataD [] (mkName "R") [] Nothing + [RecC (mkName "MkR") [(mkName "foo", NotStrict, ConT ''Int)]] []]) -- New TH story means reify only sees R if we do this: $(return []) @@ -14,7 +15,7 @@ $(return []) -- ... and check that we can inspect it main = do putStrLn $(do { info <- reify ''R ; case info of - TyConI (DataD _ _ _ [RecC _ [(n, _, _)]] _) -> + TyConI (DataD _ _ _ _ [RecC _ [(n, _, _)]] _) -> do { info' <- reify n ; lift (pprint info ++ "\n" ++ pprint info') } |