summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen/Foreign.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-01-12 14:56:41 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-22 18:27:00 -0500
commitfd0945b7bfa1e36ca79d74f8e6e0918a66d62608 (patch)
treea57bd43ad0b6d87e69f36e52802d28d9c4de5076 /compiler/GHC/Tc/Gen/Foreign.hs
parentece202297454862717cef8c06d445f8405845b28 (diff)
downloadhaskell-fd0945b7bfa1e36ca79d74f8e6e0918a66d62608.tar.gz
Move Hooks into HscEnv
Diffstat (limited to 'compiler/GHC/Tc/Gen/Foreign.hs')
-rw-r--r--compiler/GHC/Tc/Gen/Foreign.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs
index b40386e513..47d6e62997 100644
--- a/compiler/GHC/Tc/Gen/Foreign.hs
+++ b/compiler/GHC/Tc/Gen/Foreign.hs
@@ -216,8 +216,11 @@ to the module's usages.
tcForeignImports :: [LForeignDecl GhcRn]
-> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt)
-tcForeignImports decls
- = getHooked tcForeignImportsHook tcForeignImports' >>= ($ decls)
+tcForeignImports decls = do
+ hooks <- getHooks
+ case tcForeignImportsHook hooks of
+ Nothing -> tcForeignImports' decls
+ Just h -> h decls
tcForeignImports' :: [LForeignDecl GhcRn]
-> TcM ([Id], [LForeignDecl GhcTc], Bag GlobalRdrElt)
@@ -359,8 +362,11 @@ checkMissingAmpersand dflags arg_tys res_ty
tcForeignExports :: [LForeignDecl GhcRn]
-> TcM (LHsBinds GhcTc, [LForeignDecl GhcTc], Bag GlobalRdrElt)
-tcForeignExports decls =
- getHooked tcForeignExportsHook tcForeignExports' >>= ($ decls)
+tcForeignExports decls = do
+ hooks <- getHooks
+ case tcForeignExportsHook hooks of
+ Nothing -> tcForeignExports' decls
+ Just h -> h decls
tcForeignExports' :: [LForeignDecl GhcRn]
-> TcM (LHsBinds GhcTc, [LForeignDecl GhcTc], Bag GlobalRdrElt)