summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/TH_reifyExplicitForAllFams.hs
diff options
context:
space:
mode:
authorMatthew Yacavone <matthew@yacavone.net>2018-10-27 14:01:42 -0400
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-10-27 14:54:56 -0400
commit512eeb9bb9a81e915bfab25ca16bc87c62252064 (patch)
tree803e752c6907fdfc89a5f71e6bfda04d7ef86bea /testsuite/tests/th/TH_reifyExplicitForAllFams.hs
parent23956b2ada690c78a134fe6d149940c777c7efcc (diff)
downloadhaskell-512eeb9bb9a81e915bfab25ca16bc87c62252064.tar.gz
More explicit foralls (GHC Proposal 0007)
Allow the user to explicitly bind type/kind variables in type and data family instances (including associated instances), closed type family equations, and RULES pragmas. Follows the specification of GHC Proposal 0007, also fixes #2600. Advised by Richard Eisenberg. This modifies the Template Haskell AST -- old code may break! Other Changes: - convert HsRule to a record - make rnHsSigWcType more general - add repMaybe to DsMeta Includes submodule update for Haddock. Test Plan: validate Reviewers: goldfire, bgamari, alanz Subscribers: simonpj, RyanGlScott, goldfire, rwbarton, thomie, mpickering, carter GHC Trac Issues: #2600, #14268 Differential Revision: https://phabricator.haskell.org/D4894
Diffstat (limited to 'testsuite/tests/th/TH_reifyExplicitForAllFams.hs')
-rw-r--r--testsuite/tests/th/TH_reifyExplicitForAllFams.hs35
1 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/tests/th/TH_reifyExplicitForAllFams.hs b/testsuite/tests/th/TH_reifyExplicitForAllFams.hs
new file mode 100644
index 0000000000..60a6d4563f
--- /dev/null
+++ b/testsuite/tests/th/TH_reifyExplicitForAllFams.hs
@@ -0,0 +1,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
+ ; [| () |] })