summaryrefslogtreecommitdiff
path: root/libraries/ghci
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-07-24 17:17:47 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-26 00:58:15 -0400
commit00d9d28405a5983ae40a1815a146fb27abca10e8 (patch)
treef0d77ea51aadd9f27b296e36191de80958a3d380 /libraries/ghci
parentaae0457f412aa40dd192ca2cbea565ea60b182ec (diff)
downloadhaskell-00d9d28405a5983ae40a1815a146fb27abca10e8.tar.gz
TemplateHaskell: reifyType (#16976)
Diffstat (limited to 'libraries/ghci')
-rw-r--r--libraries/ghci/GHCi/Message.hs6
-rw-r--r--libraries/ghci/GHCi/TH.hs1
2 files changed, 6 insertions, 1 deletions
diff --git a/libraries/ghci/GHCi/Message.hs b/libraries/ghci/GHCi/Message.hs
index 319eebdfc0..d8c27b0702 100644
--- a/libraries/ghci/GHCi/Message.hs
+++ b/libraries/ghci/GHCi/Message.hs
@@ -242,6 +242,7 @@ data THMessage a where
LookupName :: Bool -> String -> THMessage (THResult (Maybe TH.Name))
Reify :: TH.Name -> THMessage (THResult TH.Info)
ReifyFixity :: TH.Name -> THMessage (THResult (Maybe TH.Fixity))
+ ReifyType :: TH.Name -> THMessage (THResult TH.Type)
ReifyInstances :: TH.Name -> [TH.Type] -> THMessage (THResult [TH.Dec])
ReifyRoles :: TH.Name -> THMessage (THResult [TH.Role])
ReifyAnnotations :: TH.AnnLookup -> TypeRep
@@ -295,7 +296,9 @@ getTHMessage = do
18 -> return (THMsg RunTHDone)
19 -> THMsg <$> AddModFinalizer <$> get
20 -> THMsg <$> (AddForeignFilePath <$> get <*> get)
- _ -> THMsg <$> AddCorePlugin <$> get
+ 21 -> THMsg <$> AddCorePlugin <$> get
+ 22 -> THMsg <$> ReifyType <$> get
+ n -> error ("getTHMessage: unknown message " ++ show n)
putTHMessage :: THMessage a -> Put
putTHMessage m = case m of
@@ -321,6 +324,7 @@ putTHMessage m = case m of
AddModFinalizer a -> putWord8 19 >> put a
AddForeignFilePath lang a -> putWord8 20 >> put lang >> put a
AddCorePlugin a -> putWord8 21 >> put a
+ ReifyType a -> putWord8 22 >> put a
data EvalOpts = EvalOpts
diff --git a/libraries/ghci/GHCi/TH.hs b/libraries/ghci/GHCi/TH.hs
index 09df787db3..927376b53d 100644
--- a/libraries/ghci/GHCi/TH.hs
+++ b/libraries/ghci/GHCi/TH.hs
@@ -183,6 +183,7 @@ instance TH.Quasi GHCiQ where
qLookupName isType occ = ghcCmd (LookupName isType occ)
qReify name = ghcCmd (Reify name)
qReifyFixity name = ghcCmd (ReifyFixity name)
+ qReifyType name = ghcCmd (ReifyType name)
qReifyInstances name tys = ghcCmd (ReifyInstances name tys)
qReifyRoles name = ghcCmd (ReifyRoles name)