summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-05-19 16:19:47 +0100
committerIan Lynagh <ian@well-typed.com>2013-05-19 16:19:47 +0100
commitfdd552e0ecaa17300670a48562995040e1d6687e (patch)
tree1f81b1676f3314ce86f2133c198ea796b8163bc6 /compiler
parentf7e33ca75eb1fffd5d4d84c109980e0ebf207743 (diff)
downloadhaskell-fdd552e0ecaa17300670a48562995040e1d6687e.tar.gz
Fix a build problem with integer-simple
We were trying to look up the mkInteger Id before we'd compiled the Integer modules. I'm not sure why this never showed up with integer-gmp; possibly we just always got lucky with the build order.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/coreSyn/CorePrep.lhs14
-rw-r--r--compiler/main/TidyPgm.lhs4
2 files changed, 12 insertions, 6 deletions
diff --git a/compiler/coreSyn/CorePrep.lhs b/compiler/coreSyn/CorePrep.lhs
index 084c853382..e55f595304 100644
--- a/compiler/coreSyn/CorePrep.lhs
+++ b/compiler/coreSyn/CorePrep.lhs
@@ -8,7 +8,8 @@ Core pass to saturate constructors and PrimOps
{-# LANGUAGE BangPatterns #-}
module CorePrep (
- corePrepPgm, corePrepExpr, cvtLitInteger
+ corePrepPgm, corePrepExpr, cvtLitInteger,
+ lookupMkIntegerName,
) where
#include "HsVersions.h"
@@ -40,6 +41,7 @@ import TysWiredIn
import DataCon
import PrimOp
import BasicTypes
+import Module
import UniqSupply
import Maybes
import OrdList
@@ -1107,10 +1109,16 @@ data CorePrepEnv = CPE {
cpe_mkIntegerId :: Id
}
+lookupMkIntegerName :: DynFlags -> HscEnv -> IO Id
+lookupMkIntegerName dflags hsc_env
+ = if thisPackage dflags == primPackageId
+ then return $ panic "Can't use Integer in ghc-prim"
+ else liftM tyThingId
+ $ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
+
mkInitialCorePrepEnv :: DynFlags -> HscEnv -> IO CorePrepEnv
mkInitialCorePrepEnv dflags hsc_env
- = do mkIntegerId <- liftM tyThingId
- $ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
+ = do mkIntegerId <- lookupMkIntegerName dflags hsc_env
return $ CPE {
cpe_dynFlags = dflags,
cpe_env = emptyVarEnv,
diff --git a/compiler/main/TidyPgm.lhs b/compiler/main/TidyPgm.lhs
index 6bb28613b6..1c6bb397ea 100644
--- a/compiler/main/TidyPgm.lhs
+++ b/compiler/main/TidyPgm.lhs
@@ -36,7 +36,6 @@ import Name hiding (varName)
import NameSet
import NameEnv
import Avail
-import PrelNames
import IfaceEnv
import TcEnv
import TcRnMonad
@@ -986,8 +985,7 @@ tidyTopBinds :: HscEnv
-> IO (TidyEnv, CoreProgram)
tidyTopBinds hsc_env this_mod unfold_env init_occ_env binds
- = do mkIntegerId <- liftM tyThingId
- $ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)
+ = do mkIntegerId <- lookupMkIntegerName dflags hsc_env
return $ tidy mkIntegerId init_env binds
where
dflags = hsc_dflags hsc_env