From ed5e2dd0d9756f02f3d6c1937d485929e8f0ca61 Mon Sep 17 00:00:00 2001
From: simonpj <unknown>
Date: Mon, 29 May 2000 10:00:38 +0000
Subject: [PATCH] [project @ 2000-05-29 10:00:38 by simonpj] Fix missing
 imports for foreign import/export

---
 ghc/compiler/rename/RnSource.lhs | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/ghc/compiler/rename/RnSource.lhs b/ghc/compiler/rename/RnSource.lhs
index ccd609623dd7..367b7a553beb 100644
--- a/ghc/compiler/rename/RnSource.lhs
+++ b/ghc/compiler/rename/RnSource.lhs
@@ -44,7 +44,8 @@ import OccName		( mkDefaultMethodOcc )
 import BasicTypes	( TopLevelFlag(..) )
 import FiniteMap	( elemFM )
 import PrelInfo		( derivableClassKeys, cCallishClassKeys,
-			  deRefStablePtr_RDR, makeStablePtr_RDR, bindIO_RDR
+			  deRefStablePtr_RDR, makeStablePtr_RDR, 
+			  bindIO_RDR, returnIO_RDR
 			)
 import Bag		( bagToList )
 import List		( partition, nub )
@@ -352,15 +353,18 @@ rnDecl (ForD (ForeignDecl name imp_exp ty ext_nm cconv src_loc))
     lookupOccRn name		        `thenRn` \ name' ->
     let 
 	extra_fvs FoExport 
-	  | isDyn     	= lookupImplicitOccsRn [makeStablePtr_RDR, deRefStablePtr_RDR, bindIO_RDR]
+	  | isDyn     	= lookupImplicitOccsRn [makeStablePtr_RDR, deRefStablePtr_RDR]
 	  | otherwise 	= returnRn (unitFV name')
 	extra_fvs other = returnRn emptyFVs
     in
     checkRn (ok_ext_nm ext_nm) (badExtName ext_nm)	`thenRn_`
-    extra_fvs imp_exp					`thenRn` \ fvs1 -> 
-    rnHsSigType fo_decl_msg ty		       		`thenRn` \ (ty', fvs2) ->
+
+    lookupImplicitOccsRn [bindIO_RDR, returnIO_RDR]	`thenRn` \ fvs1 ->
+    extra_fvs imp_exp					`thenRn` \ fvs2 -> 
+
+    rnHsSigType fo_decl_msg ty		       		`thenRn` \ (ty', fvs3) ->
     returnRn (ForD (ForeignDecl name' imp_exp ty' ext_nm cconv src_loc), 
-	      fvs1 `plusFV` fvs2)
+	      fvs1 `plusFV` fvs2 `plusFV` fvs3)
  where
   fo_decl_msg = ptext SLIT("a foreign declaration")
   isDyn	      = isDynamicExtName ext_nm
-- 
GitLab