summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonm <unknown>1998-02-03 17:16:13 +0000
committersimonm <unknown>1998-02-03 17:16:13 +0000
commitbe33dbc967b4915cfdb0307ae1b7ae3cee651b8c (patch)
treee24ad0b966727772172a1c47fa89c06cd671e507
parentc29022c49449b7d8862dcc2259e16cafe9461945 (diff)
downloadhaskell-be33dbc967b4915cfdb0307ae1b7ae3cee651b8c.tar.gz
[project @ 1998-02-03 17:13:54 by simonm]
- Fixes for bootstrapping with 3.01. - Use 'official' extension interfaces rather than internal prelude modules (such as ArrBase) where possible. - Remove some cruft. - Delete some unused imports found by '-fwarn-unused-imports'.
-rw-r--r--ghc/compiler/HsVersions.h39
-rw-r--r--ghc/compiler/basicTypes/Id.lhs15
-rw-r--r--ghc/compiler/basicTypes/IdInfo.lhs12
-rw-r--r--ghc/compiler/basicTypes/IdUtils.lhs7
-rw-r--r--ghc/compiler/basicTypes/Name.lhs6
-rw-r--r--ghc/compiler/basicTypes/UniqSupply.lhs8
-rw-r--r--ghc/compiler/basicTypes/Unique.lhs1
-rw-r--r--ghc/compiler/coreSyn/CoreSyn.lhs4
-rw-r--r--ghc/compiler/coreSyn/CoreUnfold.lhs22
-rw-r--r--ghc/compiler/coreSyn/CoreUtils.lhs4
-rw-r--r--ghc/compiler/coreSyn/PprCore.lhs6
-rw-r--r--ghc/compiler/hsSyn/HsBinds.lhs3
-rw-r--r--ghc/compiler/hsSyn/HsCore.lhs2
-rw-r--r--ghc/compiler/hsSyn/HsDecls.lhs4
-rw-r--r--ghc/compiler/hsSyn/HsPat.lhs2
-rw-r--r--ghc/compiler/hsSyn/HsPragmas.lhs180
-rw-r--r--ghc/compiler/hsSyn/HsTypes.lhs3
-rw-r--r--ghc/compiler/main/CmdLineOpts.lhs18
-rw-r--r--ghc/compiler/parser/UgenUtil.lhs2
-rw-r--r--ghc/compiler/prelude/PrelInfo.lhs12
-rw-r--r--ghc/compiler/prelude/PrelVals.lhs9
-rw-r--r--ghc/compiler/prelude/StdIdInfo.lhs2
-rw-r--r--ghc/compiler/prelude/TysPrim.lhs2
-rw-r--r--ghc/compiler/profiling/CostCentre.lhs5
-rw-r--r--ghc/compiler/reader/Lex.lhs2
-rw-r--r--ghc/compiler/reader/RdrHsSyn.lhs7
-rw-r--r--ghc/compiler/rename/Rename.lhs13
-rw-r--r--ghc/compiler/rename/RnBinds.lhs4
-rw-r--r--ghc/compiler/rename/RnEnv.lhs12
-rw-r--r--ghc/compiler/rename/RnExpr.lhs7
-rw-r--r--ghc/compiler/rename/RnIfaces.lhs15
-rw-r--r--ghc/compiler/rename/RnNames.lhs5
-rw-r--r--ghc/compiler/rename/RnSource.lhs20
-rw-r--r--ghc/compiler/simplCore/OccurAnal.lhs11
-rw-r--r--ghc/compiler/simplCore/SimplEnv.lhs23
-rw-r--r--ghc/compiler/specialise/SpecEnv.lhs2
-rw-r--r--ghc/compiler/stranal/WwLib.lhs11
-rw-r--r--ghc/compiler/types/Class.lhs3
-rw-r--r--ghc/compiler/types/TyCon.lhs9
-rw-r--r--ghc/compiler/types/Type.lhs3
-rw-r--r--ghc/compiler/utils/Argv.lhs4
-rw-r--r--ghc/compiler/utils/Digraph.lhs12
-rw-r--r--ghc/compiler/utils/FastString.lhs53
-rw-r--r--ghc/compiler/utils/ListSetOps.lhs25
-rw-r--r--ghc/compiler/utils/OrdList.lhs2
-rw-r--r--ghc/compiler/utils/Outputable.lhs2
-rw-r--r--ghc/compiler/utils/PrimPacked.lhs29
-rw-r--r--ghc/compiler/utils/SST.lhs14
-rw-r--r--ghc/compiler/utils/StringBuffer.lhs21
-rw-r--r--ghc/compiler/utils/UniqFM.lhs2
-rw-r--r--ghc/compiler/utils/UniqSet.lhs2
51 files changed, 201 insertions, 480 deletions
diff --git a/ghc/compiler/HsVersions.h b/ghc/compiler/HsVersions.h
index 2e1b154044..cd5c2207b5 100644
--- a/ghc/compiler/HsVersions.h
+++ b/ghc/compiler/HsVersions.h
@@ -43,9 +43,6 @@ you will screw up the layout where they are used in case expressions!
# define seqStrictlyST seqST
# define thenStrictlyST thenST
# define returnStrictlyST return
-# define _readHandle IOHandle.readHandle
-# define _writeHandle IOHandle.writeHandle
-# define _newHandle IOHandle.newdHandle
# define MkST ST
# if __GLASGOW_HASKELL__ >= 209
# define STATE_TOK(x) x
@@ -61,7 +58,6 @@ you will screw up the layout where they are used in case expressions!
# define failWith fail
# define MkIOError(h,errt,msg) (IOError (Just h) errt msg)
# define CCALL_THEN thenIO_Prim
-# define _filePtr IOHandle.filePtr
# define Text Show
# define IMP_FASTSTRING() import FastString
# if __GLASGOW_HASKELL__ >= 209
@@ -93,9 +89,10 @@ you will screw up the layout where they are used in case expressions!
#if defined(__GLASGOW_HASKELL__)
-- Import the beggars
-import GlaExts ( Int(..), Int#, (+#), (-#), (*#),
- quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#)
- )
+import GlaExts
+ ( Int(..), Int#, (+#), (-#), (*#),
+ quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#)
+ )
#define FAST_INT Int#
#define ILIT(x) (x#)
@@ -146,24 +143,22 @@ import GlaExts ( Int(..), Int#, (+#), (-#), (*#),
-- when compiling FastString itself
#ifndef COMPILING_FAST_STRING
--
-import FastString ( FastString, mkFastString, mkFastCharString#, nullFastString,
- consFS, headFS, tailFS, lengthFS, unpackFS, appendFS, concatFS
- )
+import qualified FastString
#endif
# define USE_FAST_STRINGS 1
-# define FAST_STRING FastString
-# define SLIT(x) (mkFastCharString# (x#))
-# define _NULL_ nullFastString
-# define _NIL_ (mkFastString "")
-# define _CONS_ consFS
-# define _HEAD_ headFS
-# define _TAIL_ tailFS
-# define _LENGTH_ lengthFS
-# define _PK_ mkFastString
-# define _UNPK_ unpackFS
-# define _APPEND_ `appendFS`
-# define _CONCAT_ concatFS
+# define FAST_STRING FastString.FastString
+# define SLIT(x) (FastString.mkFastCharString# (x#))
+# define _NULL_ FastString.nullFastString
+# define _NIL_ (FastString.mkFastString "")
+# define _CONS_ FastString.consFS
+# define _HEAD_ FastString.headFS
+# define _TAIL_ FastString.tailFS
+# define _LENGTH_ FastString.lengthFS
+# define _PK_ FastString.mkFastString
+# define _UNPK_ FastString.unpackFS
+# define _APPEND_ `FastString.appendFS`
+# define _CONCAT_ FastString.concatFS
#else
# define FAST_STRING String
# define SLIT(x) (x)
diff --git a/ghc/compiler/basicTypes/Id.lhs b/ghc/compiler/basicTypes/Id.lhs
index dc1cca8b55..5113340867 100644
--- a/ghc/compiler/basicTypes/Id.lhs
+++ b/ghc/compiler/basicTypes/Id.lhs
@@ -148,23 +148,20 @@ import BasicTypes ( Arity )
import IdInfo
import Maybes ( maybeToBool )
import Name ( nameUnique, mkLocalName, mkSysLocalName, isLocalName,
- mkCompoundName,
- isLocallyDefinedName, occNameString, modAndOcc,
- isLocallyDefined, changeUnique, isWiredInName,
- nameString, getOccString, setNameVisibility,
- isExported, ExportFlag(..), Provenance,
+ mkCompoundName, occNameString, modAndOcc,
+ changeUnique, isWiredInName, setNameVisibility,
+ ExportFlag(..), Provenance,
OccName(..), Name, Module,
NamedThing(..)
)
import PrimOp ( PrimOp )
import PrelMods ( pREL_TUP, pREL_BASE )
-import Lex ( mkTupNameStr )
import FieldLabel ( fieldLabelName, FieldLabel(..){-instances-} )
import PragmaInfo ( PragmaInfo(..) )
import SrcLoc ( mkBuiltinSrcLoc )
import TysWiredIn ( tupleTyCon )
import TyCon ( TyCon, tyConDataCons, isDataTyCon, isNewTyCon, mkSpecTyCon )
-import Type ( mkSigmaTy, mkTyVarTys, mkFunTys, splitSigmaTy,
+import Type ( mkSigmaTy, mkTyVarTys, mkFunTys,
mkTyConApp, instantiateTy, mkForAllTys,
tyVarsOfType, instantiateTy, typePrimRep,
instantiateTauTy,
@@ -175,10 +172,10 @@ import TyVar ( TyVar, alphaTyVars, isEmptyTyVarSet,
)
import UniqFM
import UniqSet -- practically all of it
-import Unique ( getBuiltinUniques, pprUnique, Unique, Uniquable(..) )
+import Unique ( getBuiltinUniques, Unique, Uniquable(..) )
import Outputable
import SrcLoc ( SrcLoc )
-import Util ( mapAccumL, nOfThem, zipEqual, assoc )
+import Util ( nOfThem, assoc )
import GlaExts ( Int# )
\end{code}
diff --git a/ghc/compiler/basicTypes/IdInfo.lhs b/ghc/compiler/basicTypes/IdInfo.lhs
index 8539d005e9..d50a60edc1 100644
--- a/ghc/compiler/basicTypes/IdInfo.lhs
+++ b/ghc/compiler/basicTypes/IdInfo.lhs
@@ -54,13 +54,9 @@ import SpecEnv ( SpecEnv, emptySpecEnv, isEmptySpecEnv )
import BasicTypes ( NewOrData )
import Demand
-import Maybes ( firstJust )
import Outputable
-import Unique ( pprUnique )
-import Util ( mapAccumL )
-ord = fromEnum :: Char -> Int
-showTypeCategory = panic "IdInfo.showTypeCategory"
+import Char ( ord )
\end{code}
An @IdInfo@ gives {\em optional} information about an @Id@. If
@@ -376,11 +372,7 @@ updateInfoMaybe (SomeUpdateInfo u) = Just u
Text instance so that the update annotations can be read in.
\begin{code}
-#ifdef REALLY_HASKELL_1_3
instance Read UpdateInfo where
-#else
-instance Text UpdateInfo where
-#endif
readsPrec p s | null s = panic "IdInfo: empty update pragma?!"
| otherwise = [(SomeUpdateInfo (map ok_digit s),"")]
where
@@ -429,8 +421,10 @@ argUsageInfo (IdInfo _ _ _ _ _ _ au _) = au
addArgUsageInfo id_info NoArgUsageInfo = id_info
addArgUsageInfo (IdInfo a b d e f g _ h) au_info = IdInfo a b d e f g au_info h
+{- UNUSED:
ppArgUsageInfo NoArgUsageInfo = empty
ppArgUsageInfo (SomeArgUsageInfo aut) = (<>) (ptext SLIT("_L_ ")) (ppArgUsageType aut)
+-}
ppArgUsage (ArgUsage n) = int n
ppArgUsage (UnknownArgUsage) = char '-'
diff --git a/ghc/compiler/basicTypes/IdUtils.lhs b/ghc/compiler/basicTypes/IdUtils.lhs
index 7307caa5cb..fe04abfd7b 100644
--- a/ghc/compiler/basicTypes/IdUtils.lhs
+++ b/ghc/compiler/basicTypes/IdUtils.lhs
@@ -9,15 +9,14 @@ module IdUtils ( primOpName ) where
#include "HsVersions.h"
import CoreSyn
-import CoreUnfold ( UnfoldingGuidance(..), Unfolding, mkUnfolding )
+import CoreUnfold ( Unfolding )
import Id ( mkPrimitiveId )
import IdInfo -- quite a few things
import StdIdInfo
import Name ( mkWiredInIdName, Name )
-import PrimOp ( primOpInfo, tagOf_PrimOp, primOp_str,
- PrimOpInfo(..), PrimOpResultInfo(..), PrimOp )
+import PrimOp ( primOpInfo, tagOf_PrimOp, PrimOpInfo(..), PrimOp )
import PrelMods ( pREL_GHC )
-import Type ( mkForAllTys, mkFunTy, mkFunTys, mkTyVarTy, mkTyConApp )
+import Type ( mkForAllTys, mkFunTy, mkFunTys, mkTyConApp )
import TysWiredIn ( boolTy )
import Unique ( mkPrimOpIdUnique )
import Util ( panic )
diff --git a/ghc/compiler/basicTypes/Name.lhs b/ghc/compiler/basicTypes/Name.lhs
index 9951f988f5..ac47387290 100644
--- a/ghc/compiler/basicTypes/Name.lhs
+++ b/ghc/compiler/basicTypes/Name.lhs
@@ -57,11 +57,11 @@ module Name (
import {-# SOURCE #-} Id ( Id )
import {-# SOURCE #-} TyCon ( TyCon )
-import CStrings ( identToC, modnameToC, cSEP )
+import CStrings ( identToC )
import CmdLineOpts ( opt_PprStyle_All, opt_OmitInterfacePragmas, opt_EnsureSplittableC )
import BasicTypes ( Module, IfaceFlavour(..), moduleString, pprModule )
-import Lex ( isLexSym, isLexConId )
+import Lex ( isLexConId )
import SrcLoc ( noSrcLoc, mkBuiltinSrcLoc, SrcLoc )
import Unique ( pprUnique, showUnique, Unique, Uniquable(..) )
import UniqSet ( UniqSet(..), emptyUniqSet, unitUniqSet, unionUniqSets, uniqSetToList,
@@ -558,14 +558,12 @@ class NamedThing a where
\begin{code}
modAndOcc :: NamedThing a => a -> (Module, OccName)
-getModule :: NamedThing a => a -> Module
getSrcLoc :: NamedThing a => a -> SrcLoc
isLocallyDefined :: NamedThing a => a -> Bool
isExported :: NamedThing a => a -> Bool
getOccString :: NamedThing a => a -> String
modAndOcc = nameModAndOcc . getName
-getModule = nameModule . getName
isExported = isExportedName . getName
getSrcLoc = nameSrcLoc . getName
isLocallyDefined = isLocallyDefinedName . getName
diff --git a/ghc/compiler/basicTypes/UniqSupply.lhs b/ghc/compiler/basicTypes/UniqSupply.lhs
index 23bd2c051e..4b83b52a61 100644
--- a/ghc/compiler/basicTypes/UniqSupply.lhs
+++ b/ghc/compiler/basicTypes/UniqSupply.lhs
@@ -24,10 +24,12 @@ module UniqSupply (
import Unique
import Util
-
import GlaExts
-import IOBase ( IO(..), IOResult(..) )
-import PrelBase ( Char(..) )
+
+#if __GLASGOW_HASKELL__ < 301
+import IOBase ( IO(..), IOResult(..) )
+#else
+#endif
w2i x = word2Int# x
i2w x = int2Word# x
diff --git a/ghc/compiler/basicTypes/Unique.lhs b/ghc/compiler/basicTypes/Unique.lhs
index c6b6f0a11b..44a06129de 100644
--- a/ghc/compiler/basicTypes/Unique.lhs
+++ b/ghc/compiler/basicTypes/Unique.lhs
@@ -638,7 +638,6 @@ errorIdKey = mkPreludeMiscIdUnique 7
foldlIdKey = mkPreludeMiscIdUnique 8
foldrIdKey = mkPreludeMiscIdUnique 9
forkIdKey = mkPreludeMiscIdUnique 10
-int2IntegerIdKey = mkPreludeMiscIdUnique 11
integerMinusOneIdKey = mkPreludeMiscIdUnique 12
integerPlusOneIdKey = mkPreludeMiscIdUnique 13
integerPlusTwoIdKey = mkPreludeMiscIdUnique 14
diff --git a/ghc/compiler/coreSyn/CoreSyn.lhs b/ghc/compiler/coreSyn/CoreSyn.lhs
index 596a7c2a69..a6fe32dce1 100644
--- a/ghc/compiler/coreSyn/CoreSyn.lhs
+++ b/ghc/compiler/coreSyn/CoreSyn.lhs
@@ -53,11 +53,11 @@ module CoreSyn (
#include "HsVersions.h"
-import CostCentre ( showCostCentre, CostCentre )
+import CostCentre ( CostCentre )
import Id ( idType, GenId{-instance Eq-}, Id )
import Type ( isUnboxedType,GenType, Type )
import TyVar ( GenTyVar, TyVar )
-import Util ( panic, assertPanic {-pprTrace:ToDo:rm-} )
+import Util ( panic, assertPanic )
import BinderInfo ( BinderInfo )
import BasicTypes ( Unused )
import Literal ( Literal )
diff --git a/ghc/compiler/coreSyn/CoreUnfold.lhs b/ghc/compiler/coreSyn/CoreUnfold.lhs
index c92ffe6bdf..31276b697e 100644
--- a/ghc/compiler/coreSyn/CoreUnfold.lhs
+++ b/ghc/compiler/coreSyn/CoreUnfold.lhs
@@ -15,14 +15,14 @@ find, unsurprisingly, a Core expression.
\begin{code}
module CoreUnfold (
SimpleUnfolding(..), Unfolding(..), UnfoldingGuidance(..), -- types
- UfExpr, RdrName, -- For closure (delete in 1.3)
- FormSummary(..), mkFormSummary, whnfOrBottom, exprSmallEnoughToDup, exprIsTrivial,
+ FormSummary(..), mkFormSummary, whnfOrBottom, exprSmallEnoughToDup,
+ exprIsTrivial,
noUnfolding, mkMagicUnfolding, mkUnfolding, getUnfoldingTemplate,
- smallEnoughToInline, couldBeSmallEnoughToInline, certainlySmallEnoughToInline,
- inlineUnconditionally,
+ smallEnoughToInline, couldBeSmallEnoughToInline,
+ certainlySmallEnoughToInline, inlineUnconditionally,
calcUnfoldingGuidance,
@@ -33,8 +33,6 @@ module CoreUnfold (
import {-# SOURCE #-} MagicUFs ( MagicUnfoldingFun, mkMagicUnfoldingFun )
-import Bag ( emptyBag, unitBag, unionBags, Bag )
-
import CmdLineOpts ( opt_UnfoldingCreationThreshold,
opt_UnfoldingUseThreshold,
opt_UnfoldingConDiscount,
@@ -49,23 +47,17 @@ import BinderInfo ( BinderInfo, isOneFunOcc, isOneSafeFunOcc
import PragmaInfo ( PragmaInfo(..) )
import CoreSyn
import CoreUtils ( unTagBinders )
-import HsCore ( UfExpr )
-import RdrHsSyn ( RdrName )
import OccurAnal ( occurAnalyseGlobalExpr )
import CoreUtils ( coreExprType )
import Id ( Id, idType, getIdArity, isBottomingId, isDataCon,
idWantsToBeINLINEd, idMustBeINLINEd, idMustNotBeINLINEd,
IdSet, GenId{-instances-} )
-import PrimOp ( primOpCanTriggerGC, fragilePrimOp, PrimOp(..) )
-import IdInfo ( ArityInfo(..), bottomIsGuaranteed )
-import Literal ( isNoRepLit, isLitLitLit )
+import PrimOp ( fragilePrimOp, primOpCanTriggerGC )
+import IdInfo ( ArityInfo(..) )
+import Literal ( isNoRepLit )
import TyCon ( tyConFamilySize )
import Type ( splitAlgTyConApp_maybe )
import Unique ( Unique )
-import UniqSet ( emptyUniqSet, unitUniqSet, mkUniqSet,
- addOneToUniqSet, unionUniqSets
- )
-import Maybes ( maybeToBool )
import Util ( isIn, panic, assertPanic )
import Outputable
\end{code}
diff --git a/ghc/compiler/coreSyn/CoreUtils.lhs b/ghc/compiler/coreSyn/CoreUtils.lhs
index bfc21df742..1ecaadf61e 100644
--- a/ghc/compiler/coreSyn/CoreUtils.lhs
+++ b/ghc/compiler/coreSyn/CoreUtils.lhs
@@ -29,7 +29,7 @@ import Id ( idType, mkSysLocal, isBottomingId,
addOneToIdEnv, growIdEnvList, lookupIdEnv,
isNullIdEnv, IdEnv, Id
)
-import Literal ( literalType, isNoRepLit, Literal(..) )
+import Literal ( literalType, Literal(..) )
import Maybes ( catMaybes, maybeToBool )
import PprCore
import PrimOp ( primOpType, PrimOp(..) )
@@ -46,7 +46,7 @@ import Type ( mkFunTy, mkForAllTy, mkTyVarTy,
import TysWiredIn ( trueDataCon, falseDataCon )
import Unique ( Unique )
import BasicTypes ( Unused )
-import UniqSupply ( initUs, returnUs, thenUs,
+import UniqSupply ( returnUs, thenUs,
mapUs, mapAndUnzipUs, getUnique,
UniqSM, UniqSupply
)
diff --git a/ghc/compiler/coreSyn/PprCore.lhs b/ghc/compiler/coreSyn/PprCore.lhs
index 0c29fa0351..9eeadaf96a 100644
--- a/ghc/compiler/coreSyn/PprCore.lhs
+++ b/ghc/compiler/coreSyn/PprCore.lhs
@@ -17,13 +17,11 @@ module PprCore (
import CoreSyn
import CostCentre ( showCostCentre )
-import Id ( idType, getIdInfo, getIdStrictness, isTupleCon,
- nullIdEnv, DataCon, GenId{-instances-},
- Id
+import Id ( idType, getIdInfo, isTupleCon,
+ DataCon, GenId{-instances-}, Id
)
import IdInfo ( ppIdInfo, ppStrictnessInfo )
import Literal ( Literal{-instances-} )
-import Name ( OccName )
import Outputable -- quite a few things
import PprEnv
import PprType ( pprParendGenType, pprTyVarBndr, GenType{-instances-}, GenTyVar{-instance-} )
diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs
index d020b76baf..b5578034d0 100644
--- a/ghc/compiler/hsSyn/HsBinds.lhs
+++ b/ghc/compiler/hsSyn/HsBinds.lhs
@@ -14,13 +14,12 @@ import {-# SOURCE #-} HsExpr ( pprExpr, HsExpr )
import {-# SOURCE #-} HsMatches ( pprMatches, Match, pprGRHSsAndBinds, GRHSsAndBinds )
-- friends:
-import HsPragmas ( GenPragmas, ClassOpPragmas )
import HsTypes ( HsType )
import CoreSyn ( CoreExpr )
import PprCore () -- Instances for Outputable
--others:
-import Id ( DictVar, Id, GenId )
+import Id ( Id, GenId )
import Name ( OccName, NamedThing(..) )
import BasicTypes ( RecFlag(..) )
import Outputable
diff --git a/ghc/compiler/hsSyn/HsCore.lhs b/ghc/compiler/hsSyn/HsCore.lhs
index 05226a126e..53d16be955 100644
--- a/ghc/compiler/hsSyn/HsCore.lhs
+++ b/ghc/compiler/hsSyn/HsCore.lhs
@@ -21,9 +21,7 @@ module HsCore (
-- friends:
import HsTypes ( HsType, pprParendHsType )
-import PrimOp ( PrimOp, tagOf_PrimOp )
import Kind ( Kind {- instance Outputable -} )
-import Type ( GenType {- instance Outputable -} )
-- others:
import Literal ( Literal )
diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs
index f466d59002..ce68cefce8 100644
--- a/ghc/compiler/hsSyn/HsDecls.lhs
+++ b/ghc/compiler/hsSyn/HsDecls.lhs
@@ -13,9 +13,7 @@ module HsDecls where
-- friends:
import HsBinds ( HsBinds, MonoBinds, Sig, nullMonoBinds )
-import HsPragmas ( DataPragmas, ClassPragmas,
- InstancePragmas, ClassOpPragmas
- )
+import HsPragmas ( DataPragmas, ClassPragmas )
import HsTypes
import HsCore ( UfExpr )
import BasicTypes ( Fixity, NewOrData(..) )
diff --git a/ghc/compiler/hsSyn/HsPat.lhs b/ghc/compiler/hsSyn/HsPat.lhs
index 8e89bb2f3d..ffbd373b16 100644
--- a/ghc/compiler/hsSyn/HsPat.lhs
+++ b/ghc/compiler/hsSyn/HsPat.lhs
@@ -214,8 +214,6 @@ pprOutPat (DictPat dicts methods)
brackets (interpp'SP dicts),
brackets (interpp'SP methods)])
-pprConPatTy ty
- = parens (ppr ty)
\end{code}
%************************************************************************
diff --git a/ghc/compiler/hsSyn/HsPragmas.lhs b/ghc/compiler/hsSyn/HsPragmas.lhs
index 418c150783..c2aed3620c 100644
--- a/ghc/compiler/hsSyn/HsPragmas.lhs
+++ b/ghc/compiler/hsSyn/HsPragmas.lhs
@@ -16,10 +16,6 @@ module HsPragmas where
#include "HsVersions.h"
--- friends:
-import HsTypes ( HsType )
-
--- others:
import IdInfo
import Outputable
\end{code}
@@ -60,179 +56,3 @@ instance Outputable name => Outputable (InstancePragmas name) where
instance Outputable name => Outputable (GenPragmas name) where
ppr NoGenPragmas = empty
\end{code}
-
-========================= OLD CODE SCEDULED FOR DELETION SLPJ Nov 96 ==============
-
-\begin{code}
-{- COMMENTED OUT
-
-Certain pragmas expect to be pinned onto certain constructs.
-
-Pragma types may be parameterised, just as with any other
-abstract-syntax type.
-
-For a @data@ declaration---indicates which specialisations exist.
-\begin{code}
-data DataPragmas name
- = NoDataPragmas
- | DataPragmas [[Maybe (HsType name)]] -- types to which specialised
-
-noDataPragmas = NoDataPragmas
-isNoDataPragmas NoDataPragmas = True
-\end{code}
-
-These are {\em general} things you can know about any value:
-\begin{code}
-data GenPragmas name
- = NoGenPragmas
- | GenPragmas (Maybe Int) -- arity (maybe)
- (Maybe UpdateInfo) -- update info (maybe)
- (ImpStrictness name) -- strictness, worker-wrapper
- (ImpUnfolding name) -- unfolding (maybe)
- [([Maybe (HsType name)], -- Specialisations: types to which spec'd;
- Int, -- # dicts to ignore
- GenPragmas name)] -- Gen info about the spec'd version
-
-noGenPragmas = NoGenPragmas
-
-isNoGenPragmas NoGenPragmas = True
-isNoGenPragmas _ = False
-
-data ImpUnfolding name
- = NoImpUnfolding
- | ImpMagicUnfolding FAST_STRING -- magic "unfolding"
- -- known to the compiler by "String"
- | ImpUnfolding UnfoldingGuidance -- always, if you like, etc.
- (UnfoldingCoreExpr name)
-
-data ImpStrictness name
- = NoImpStrictness
- | ImpStrictness Bool -- True <=> bottoming Id
- [Demand] -- demand info
- (GenPragmas name) -- about the *worker*
-\end{code}
-
-For an ordinary imported function: it can have general pragmas (only).
-
-For a class's super-class dictionary selectors:
-\begin{code}
-data ClassPragmas name
- = NoClassPragmas
- | SuperDictPragmas [GenPragmas name] -- list mustn't be empty
-
-noClassPragmas = NoClassPragmas
-
-isNoClassPragmas NoClassPragmas = True
-isNoClassPragmas _ = False
-\end{code}
-
-For a class's method selectors:
-\begin{code}
-data ClassOpPragmas name
- = NoClassOpPragmas
- | ClassOpPragmas (GenPragmas name) -- for method selector
- (GenPragmas name) -- for default method
-
-
-noClassOpPragmas = NoClassOpPragmas
-
-isNoClassOpPragmas NoClassOpPragmas = True
-isNoClassOpPragmas _ = False
-\end{code}
-
-\begin{code}
-data InstancePragmas name
- = NoInstancePragmas
-
- | SimpleInstancePragma -- nothing but for the dfun itself...
- (GenPragmas name)
-
- | ConstantInstancePragma
- (GenPragmas name) -- for the "dfun" itself
- [(name, GenPragmas name)] -- one per class op
-
- | SpecialisedInstancePragma
- (GenPragmas name) -- for its "dfun"
- [([Maybe (HsType name)], -- specialised instance; type...
- Int, -- #dicts to ignore
- InstancePragmas name)] -- (no SpecialisedInstancePragma please!)
-
-noInstancePragmas = NoInstancePragmas
-
-isNoInstancePragmas NoInstancePragmas = True
-isNoInstancePragmas _ = False
-\end{code}
-
-Some instances for printing (just for debugging, really)
-\begin{code}
-instance Outputable name => Outputable (ClassPragmas name) where
- ppr NoClassPragmas = empty
- ppr (SuperDictPragmas sdsel_prags)
- = ($$) (ptext SLIT("{-superdict pragmas-}"))
- (ppr sdsel_prags)
-
-instance Outputable name => Outputable (ClassOpPragmas name) where
- ppr NoClassOpPragmas = empty
- ppr (ClassOpPragmas op_prags defm_prags)
- = ($$) (hsep [ptext SLIT("{-meth-}"), ppr op_prags])
- (hsep [ptext SLIT("{-defm-}"), ppr defm_prags])
-
-instance Outputable name => Outputable (InstancePragmas name) where
- ppr NoInstancePragmas = empty
- ppr (SimpleInstancePragma dfun_pragmas)
- = hsep [ptext SLIT("{-dfun-}"), ppr dfun_pragmas]
- ppr (ConstantInstancePragma dfun_pragmas name_pragma_pairs)
- = ($$) (hsep [ptext SLIT("{-constm-}"), ppr dfun_pragmas])
- (vcat (map pp_pair name_pragma_pairs))
- where
- pp_pair (n, prags)
- = hsep [ppr n, equals, ppr prags]
-
- ppr (SpecialisedInstancePragma dfun_pragmas spec_pragma_info)
- = ($$) (hsep [ptext SLIT("{-spec'd-}"), ppr dfun_pragmas])
- (vcat (map pp_info spec_pragma_info))
- where
- pp_info (ty_maybes, num_dicts, prags)
- = hcat [brackets (hsep (map pp_ty ty_maybes)),
- parens (int num_dicts), equals, ppr prags]
- pp_ty Nothing = ptext SLIT("_N_")
- pp_ty (Just t)= ppr t
-
-instance Outputable name => Outputable (GenPragmas name) where
- ppr NoGenPragmas = empty
- ppr (GenPragmas arity_maybe upd_maybe def strictness unfolding specs)
- = hsep [pp_arity arity_maybe, pp_upd upd_maybe, -- ToDo: print def?
- pp_str strictness, pp_unf unfolding,
- pp_specs specs]
- where
- pp_arity Nothing = empty
- pp_arity (Just i) = (<>) (ptext SLIT("ARITY=")) (int i)
-
- pp_upd Nothing = empty
- pp_upd (Just u) = ppUpdateInfo u
-
- pp_str NoImpStrictness = empty
- pp_str (ImpStrictness is_bot demands wrkr_prags)
- = hcat [ptext SLIT("IS_BOT="), ppr is_bot,
- ptext SLIT("STRICTNESS="), text (showList demands ""),
- ptext SLIT(" {"), ppr wrkr_prags, char '}']
-
- pp_unf NoImpUnfolding = ptext SLIT("NO_UNFOLDING")
- pp_unf (ImpMagicUnfolding m) = (<>) (ptext SLIT("MAGIC=")) (ptext m)
- pp_unf (ImpUnfolding g core) = (<>) (ptext SLIT("UNFOLD=")) (ppr core)
-
- pp_specs [] = empty
- pp_specs specs
- = hcat [ptext SLIT("SPECS=["), hsep (map pp_spec specs), char ']']
- where
- pp_spec (ty_maybes, num_dicts, gprags)
- = hsep [brackets (hsep (map pp_MaB ty_maybes)), int num_dicts, ppr gprags]
-
- pp_MaB Nothing = ptext SLIT("_N_")
- pp_MaB (Just x) = ppr x
-\end{code}
-
-
-\begin{code}
--}
-\end{code}
diff --git a/ghc/compiler/hsSyn/HsTypes.lhs b/ghc/compiler/hsSyn/HsTypes.lhs
index 759251b5fc..e2b1354df6 100644
--- a/ghc/compiler/hsSyn/HsTypes.lhs
+++ b/ghc/compiler/hsSyn/HsTypes.lhs
@@ -23,8 +23,7 @@ module HsTypes (
import Outputable
import Kind ( Kind {- instance Outputable -} )
-import Name ( nameOccName )
-import Util ( thenCmp, cmpList, isIn, panic )
+import Util ( thenCmp, cmpList, panic )
import GlaExts ( Int#, (<#) )
\end{code}
diff --git a/ghc/compiler/main/CmdLineOpts.lhs b/ghc/compiler/main/CmdLineOpts.lhs
index 7b1a71d333..c9278fe78b 100644
--- a/ghc/compiler/main/CmdLineOpts.lhs
+++ b/ghc/compiler/main/CmdLineOpts.lhs
@@ -105,12 +105,17 @@ module CmdLineOpts (
import Array ( array, (//) )
import GlaExts
-import ArrBase
import Argv
import Constants -- Default values for some flags
import Maybes ( assocMaybe, firstJust, maybeToBool )
-import Util ( startsWith, panic, panic#, assertPanic )
+import Util ( startsWith, panic, panic# )
+
+#if __GLASGOW_HASKELL__ < 301
+import ArrBase ( Array(..) )
+#else
+import PrelArr ( Array(..) )
+#endif
\end{code}
A command-line {\em switch} is (generally) either on or off; e.g., the
@@ -588,15 +593,6 @@ switchIsOn lookup_fn switch
SwBool False -> False
_ -> True
-stringSwitchSet :: (switch -> SwitchResult)
- -> (FAST_STRING -> switch)
- -> Maybe FAST_STRING
-
-stringSwitchSet lookup_fn switch
- = case (lookup_fn (switch (panic "stringSwitchSet"))) of
- SwString str -> Just str
- _ -> Nothing
-
intSwitchSet :: (switch -> SwitchResult)
-> (Int -> switch)
-> Maybe Int
diff --git a/ghc/compiler/parser/UgenUtil.lhs b/ghc/compiler/parser/UgenUtil.lhs
index 10bcca358b..c73b6cefa9 100644
--- a/ghc/compiler/parser/UgenUtil.lhs
+++ b/ghc/compiler/parser/UgenUtil.lhs
@@ -12,8 +12,6 @@ module UgenUtil (
import GlaExts
import Name
-import RdrHsSyn ( RdrName(..) )
-import BasicTypes ( IfaceFlavour )
import SrcLoc ( mkSrcLoc, noSrcLoc, SrcLoc )
import FastString ( FastString, mkFastCharString, mkFastCharString2 )
\end{code}
diff --git a/ghc/compiler/prelude/PrelInfo.lhs b/ghc/compiler/prelude/PrelInfo.lhs
index f4f3cabf18..de1a41e57c 100644
--- a/ghc/compiler/prelude/PrelInfo.lhs
+++ b/ghc/compiler/prelude/PrelInfo.lhs
@@ -171,18 +171,6 @@ data_tycons
, voidTyCon
, wordTyCon
]
-
-min_nonprim_tycon_list -- used w/ HideMostBuiltinNames
- = [ boolTyCon
- , charTyCon
- , intTyCon
- , floatTyCon
- , doubleTyCon
- , integerTyCon
- , liftTyCon
- , return2GMPsTyCon -- ADR asked for these last two (WDP 94/11)
- , returnIntAndGMPTyCon
- ]
\end{code}
%************************************************************************
diff --git a/ghc/compiler/prelude/PrelVals.lhs b/ghc/compiler/prelude/PrelVals.lhs
index 9f6930b269..4d3660488a 100644
--- a/ghc/compiler/prelude/PrelVals.lhs
+++ b/ghc/compiler/prelude/PrelVals.lhs
@@ -8,9 +8,9 @@ module PrelVals where
#include "HsVersions.h"
-import {-# SOURCE #-} CoreUnfold ( UnfoldingGuidance(..), mkUnfolding )
+import {-# SOURCE #-} CoreUnfold ( mkUnfolding )
-import Id ( Id, mkImported, mkTemplateLocals )
+import Id ( Id, mkImported )
import SpecEnv ( SpecEnv, emptySpecEnv )
-- friends:
@@ -19,15 +19,12 @@ import TysPrim
import TysWiredIn
-- others:
-import CmdLineOpts ( maybe_CompilingGhcInternals )
import CoreSyn -- quite a bit
import IdInfo -- quite a bit
-import Literal ( mkMachInt )
import Name ( mkWiredInIdName, Module )
import PragmaInfo
-import PrimOp ( PrimOp(..) )
import Type
-import TyVar ( openAlphaTyVar, alphaTyVar, betaTyVar, gammaTyVar, TyVar )
+import TyVar ( openAlphaTyVar, alphaTyVar, betaTyVar, TyVar )
import Unique -- lots of *Keys
import Util ( panic )
\end{code}
diff --git a/ghc/compiler/prelude/StdIdInfo.lhs b/ghc/compiler/prelude/StdIdInfo.lhs
index 58c2811861..f9fe248460 100644
--- a/ghc/compiler/prelude/StdIdInfo.lhs
+++ b/ghc/compiler/prelude/StdIdInfo.lhs
@@ -35,7 +35,7 @@ import Id ( GenId, mkTemplateLocals, idType,
)
import IdInfo ( ArityInfo, exactArity )
import Class ( classBigSig, classTyCon )
-import TyCon ( isNewTyCon, isDataTyCon, isAlgTyCon, tyConDataCons )
+import TyCon ( isNewTyCon, tyConDataCons )
import FieldLabel ( FieldLabel )
import PrelVals ( pAT_ERROR_ID )
import Maybes
diff --git a/ghc/compiler/prelude/TysPrim.lhs b/ghc/compiler/prelude/TysPrim.lhs
index 37ad832f88..7a8796a216 100644
--- a/ghc/compiler/prelude/TysPrim.lhs
+++ b/ghc/compiler/prelude/TysPrim.lhs
@@ -11,7 +11,7 @@ module TysPrim where
#include "HsVersions.h"
-import Kind ( mkUnboxedTypeKind, mkBoxedTypeKind, mkTypeKind, mkArrowKind )
+import Kind ( mkBoxedTypeKind )
import Name ( mkWiredInTyConName )
import PrimRep ( PrimRep(..) ) -- getPrimRepInfo uses PrimRep repn
import TyCon ( mkPrimTyCon, mkDataTyCon, TyCon )
diff --git a/ghc/compiler/profiling/CostCentre.lhs b/ghc/compiler/profiling/CostCentre.lhs
index 4d1cfcddc8..a1478da21f 100644
--- a/ghc/compiler/profiling/CostCentre.lhs
+++ b/ghc/compiler/profiling/CostCentre.lhs
@@ -28,9 +28,9 @@ module CostCentre (
#include "HsVersions.h"
-import Id ( externallyVisibleId, GenId, showId, Id )
+import Id ( externallyVisibleId, GenId, Id )
import CStrings ( identToC, stringToC )
-import Name ( OccName, getOccString, moduleString, nameString )
+import Name ( OccName, getOccString, moduleString )
import Outputable
import Util ( panic, panic#, assertPanic, thenCmp )
@@ -497,7 +497,6 @@ uppCostCentreDecl is_local cc
where
cc_IS_CAF = "CC_IS_CAF"
cc_IS_DICT = "CC_IS_DICT"
- cc_IS_SUBSUMED = "CC_IS_SUBSUMED"
cc_IS_BORING = "CC_IS_BORING"
do_caf IsCafCC = cc_IS_CAF
diff --git a/ghc/compiler/reader/Lex.lhs b/ghc/compiler/reader/Lex.lhs
index b3126559dc..5ce4cc793d 100644
--- a/ghc/compiler/reader/Lex.lhs
+++ b/ghc/compiler/reader/Lex.lhs
@@ -32,7 +32,7 @@ module Lex (
#include "HsVersions.h"
-import Char (isDigit, isAlpha, isAlphanum, isUpper,isLower, isSpace, ord )
+import Char (isDigit, isAlphanum, isUpper,isLower, isSpace, ord )
import {-# SOURCE #-} CostCentre
diff --git a/ghc/compiler/reader/RdrHsSyn.lhs b/ghc/compiler/reader/RdrHsSyn.lhs
index 5cd65ddca1..922fe48ffa 100644
--- a/ghc/compiler/reader/RdrHsSyn.lhs
+++ b/ghc/compiler/reader/RdrHsSyn.lhs
@@ -56,13 +56,10 @@ module RdrHsSyn (
import HsSyn
import Lex
-import PrelMods ( pRELUDE )
-import BasicTypes ( Module(..), NewOrData, IfaceFlavour(..), Unused )
-import Name ( ExportFlag(..), pprModule,
- OccName(..), pprOccName,
+import BasicTypes ( Module(..), IfaceFlavour(..), Unused )
+import Name ( pprModule, OccName(..), pprOccName,
prefixOccName, NamedThing )
import Util ( thenCmp )
-import CoreSyn ( GenCoreExpr )
import HsPragmas ( GenPragmas, ClassPragmas, DataPragmas, ClassOpPragmas, InstancePragmas )
import List ( nub )
import Outputable
diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs
index 0cb23f06dd..e221088e33 100644
--- a/ghc/compiler/rename/Rename.lhs
+++ b/ghc/compiler/rename/Rename.lhs
@@ -9,10 +9,10 @@ module Rename ( renameModule ) where
#include "HsVersions.h"
import HsSyn
-import RdrHsSyn ( RdrName(..), RdrNameHsModule, RdrNameImportDecl )
+import RdrHsSyn ( RdrName(..), RdrNameHsModule )
import RnHsSyn ( RenamedHsModule, RenamedHsDecl, extractHsTyNames )
-import CmdLineOpts ( opt_HiMap, opt_WarnNameShadowing, opt_D_show_rn_trace,
+import CmdLineOpts ( opt_HiMap, opt_D_show_rn_trace,
opt_D_dump_rn, opt_D_show_rn_stats,
opt_WarnUnusedBinds, opt_WarnUnusedImports
)
@@ -23,11 +23,9 @@ import RnIfaces ( getImportedInstDecls, importDecl, getImportVersions, getSpeci
getDeferredDataDecls,
mkSearchPath, getSlurpedNames, getRnStats
)
-import RnEnv ( availsToNameSet, addAvailToNameSet,
- addImplicitOccsRn, lookupImplicitOccRn )
-import Name ( Name, PrintUnqualified, Provenance, ExportFlag(..),
- isLocallyDefined,
- NameSet(..), elemNameSet, mkNameSet, unionNameSets,
+import RnEnv ( addImplicitOccsRn )
+import Name ( Name, PrintUnqualified, Provenance, isLocallyDefined,
+ NameSet(..),
nameSetToList, minusNameSet, NamedThing(..),
nameModule, pprModule, pprOccName, nameOccName
)
@@ -38,7 +36,6 @@ import PrelInfo ( ioTyCon_NAME )
import ErrUtils ( pprBagOfErrors, pprBagOfWarnings,
doIfSet, dumpIfSet, ghcExit
)
-import FiniteMap ( emptyFM, eltsFM, fmToList, addToFM, FiniteMap )
import Bag ( isEmptyBag )
import UniqSupply ( UniqSupply )
import Util ( equivClasses )
diff --git a/ghc/compiler/rename/RnBinds.lhs b/ghc/compiler/rename/RnBinds.lhs
index 4a7bd54ee3..92e221e2c6 100644
--- a/ghc/compiler/rename/RnBinds.lhs
+++ b/ghc/compiler/rename/RnBinds.lhs
@@ -20,7 +20,6 @@ module RnBinds (
import {-# SOURCE #-} RnSource ( rnHsSigType )
import HsSyn
-import HsPragmas ( isNoGenPragmas, noGenPragmas )
import RdrHsSyn
import RnHsSyn
import RnMonad
@@ -36,8 +35,7 @@ import Name ( OccName(..), Provenance,
minusNameSet, unionManyNameSets, elemNameSet, unitNameSet, nameSetToList
)
import BasicTypes ( RecFlag(..), TopLevelFlag(..) )
-import Maybes ( catMaybes )
-import Util ( thenCmp, isIn, removeDups, panic, panic#, assertPanic, assocDefault )
+import Util ( thenCmp, removeDups, panic, panic#, assertPanic )
import UniqSet ( UniqSet )
import ListSetOps ( minusList )
import Bag ( bagToList )
diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs
index 664fa70022..c41b0bd7a7 100644
--- a/ghc/compiler/rename/RnEnv.lhs
+++ b/ghc/compiler/rename/RnEnv.lhs
@@ -12,25 +12,23 @@ import CmdLineOpts ( opt_WarnNameShadowing, opt_WarnUnusedMatches,
opt_WarnUnusedBinds, opt_WarnUnusedImports )
import HsSyn
import RdrHsSyn ( RdrName(..), RdrNameIE,
- rdrNameOcc, ieOcc, isQual, qual
+ rdrNameOcc, isQual, qual
)
import HsTypes ( getTyVarName, replaceTyVarName )
-import BasicTypes ( Fixity(..), FixityDirection(..), IfaceFlavour(..), pprModule )
+import BasicTypes ( Fixity(..), FixityDirection(..), IfaceFlavour(..) )
import RnMonad
import Name ( Name, OccName(..), Provenance(..), ExportFlag(..), NamedThing(..),
- occNameString, occNameFlavour, getSrcLoc,
+ occNameFlavour, getSrcLoc,
NameSet, emptyNameSet, addListToNameSet, nameSetToList,
mkLocalName, mkGlobalName, modAndOcc,
nameOccName, setNameProvenance, isVarOcc, getNameProvenance,
- pprProvenance, pprOccName, pprModule, pprNameProvenance,
- isLocalName
+ pprOccName, isLocalName
)
import TyCon ( TyCon )
-import TysWiredIn ( tupleTyCon, listTyCon, charTyCon, intTyCon )
+import TysWiredIn ( tupleTyCon, listTyCon, charTyCon )
import FiniteMap
import Unique ( Unique, Uniquable(..), unboundKey )
import UniqFM ( listToUFM, plusUFM_C )
-import Maybes ( maybeToBool )
import UniqSupply
import SrcLoc ( SrcLoc, noSrcLoc )
import Outputable
diff --git a/ghc/compiler/rename/RnExpr.lhs b/ghc/compiler/rename/RnExpr.lhs
index 165555e1ad..4a7bd2283b 100644
--- a/ghc/compiler/rename/RnExpr.lhs
+++ b/ghc/compiler/rename/RnExpr.lhs
@@ -37,11 +37,8 @@ import TysPrim ( charPrimTyCon, addrPrimTyCon, intPrimTyCon,
floatPrimTyCon, doublePrimTyCon
)
import Name
-import UniqFM ( lookupUFM, {- ToDo:rm-} isNullUFM )
-import UniqSet ( emptyUniqSet, unitUniqSet,
- unionUniqSets, unionManyUniqSets,
- UniqSet
- )
+import UniqFM ( isNullUFM )
+import UniqSet ( emptyUniqSet, unionManyUniqSets, UniqSet )
import Util ( removeDups )
import Outputable
\end{code}
diff --git a/ghc/compiler/rename/RnIfaces.lhs b/ghc/compiler/rename/RnIfaces.lhs
index f5e5e7783b..fc92acabb9 100644
--- a/ghc/compiler/rename/RnIfaces.lhs
+++ b/ghc/compiler/rename/RnIfaces.lhs
@@ -26,25 +26,24 @@ import HsSyn ( HsDecl(..), TyDecl(..), ClassDecl(..), InstDecl(..), IfaceSig(..
HsType(..), ConDecl(..), IE(..), ConDetails(..), Sig(..),
hsDeclName
)
-import HsPragmas ( noGenPragmas )
import BasicTypes ( Version, NewOrData(..), IfaceFlavour(..) )
import RdrHsSyn ( RdrNameHsDecl, RdrNameInstDecl, RdrNameTyDecl,
RdrName(..), rdrNameOcc
)
-import RnEnv ( newImportedGlobalName, addImplicitOccsRn, ifaceFlavour,
- availName, availNames, addAvailToNameSet, pprAvail
+import RnEnv ( newImportedGlobalName, addImplicitOccsRn,
+ ifaceFlavour, availName, availNames, addAvailToNameSet
)
import RnSource ( rnHsSigType )
import RnMonad
import RnHsSyn ( RenamedHsDecl )
import ParseIface ( parseIface, IfaceStuff(..) )
-import FiniteMap ( FiniteMap, sizeFM, emptyFM, unitFM, delFromFM,
+import FiniteMap ( FiniteMap, sizeFM, emptyFM, delFromFM,
lookupFM, addToFM, addToFM_C, addListToFM,
- fmToList, eltsFM
+ fmToList
)
import Name ( Name {-instance NamedThing-}, Provenance, OccName(..),
- nameModule, occNameString, moduleString, pprModule, isLocallyDefined,
+ nameModule, moduleString, pprModule, isLocallyDefined,
NameSet(..), emptyNameSet, unionNameSets, nameSetToList,
minusNameSet, mkNameSet, elemNameSet, nameUnique, addOneToNameSet,
isWiredInName, maybeWiredInTyConName, maybeWiredInIdName,
@@ -58,11 +57,11 @@ import SrcLoc ( mkSrcLoc, SrcLoc )
import PrelMods ( pREL_GHC )
import PrelInfo ( cCallishTyKeys )
import Bag
-import Maybes ( MaybeErr(..), expectJust, maybeToBool )
+import Maybes ( MaybeErr(..), maybeToBool )
import ListSetOps ( unionLists )
import Outputable
import Unique ( Unique )
-import StringBuffer ( StringBuffer, hGetStringBuffer, freeStringBuffer )
+import StringBuffer ( StringBuffer, hGetStringBuffer )
import FastString ( mkFastString )
import Outputable
diff --git a/ghc/compiler/rename/RnNames.lhs b/ghc/compiler/rename/RnNames.lhs
index f8cf4b11f8..f69ebb329c 100644
--- a/ghc/compiler/rename/RnNames.lhs
+++ b/ghc/compiler/rename/RnNames.lhs
@@ -23,7 +23,6 @@ import RdrHsSyn ( RdrNameHsDecl(..), RdrName(..), RdrNameIE(..), RdrNameImportDe
RdrNameHsModule, RdrNameFixityDecl,
rdrNameOcc, ieOcc
)
-import RnHsSyn ( RenamedHsModule(..), RenamedFixityDecl(..) )
import RnIfaces ( getInterfaceExports, getDeclBinders, recordSlurp, checkUpToDate )
import BasicTypes ( IfaceFlavour(..) )
import RnEnv
@@ -31,9 +30,9 @@ import RnMonad
import FiniteMap
import PrelMods
-import UniqFM ( UniqFM, emptyUFM, addListToUFM_C, lookupUFM )
+import UniqFM ( UniqFM, addListToUFM_C, lookupUFM )
import Bag ( Bag, bagToList )
-import Maybes ( maybeToBool, expectJust )
+import Maybes ( maybeToBool )
import Name
import Outputable
import Util ( removeDups )
diff --git a/ghc/compiler/rename/RnSource.lhs b/ghc/compiler/rename/RnSource.lhs
index 4a64569092..cb5abf3e43 100644
--- a/ghc/compiler/rename/RnSource.lhs
+++ b/ghc/compiler/rename/RnSource.lhs
@@ -25,23 +25,17 @@ import RnEnv ( bindTyVarsRn, lookupBndrRn, lookupOccRn, lookupImplicitOccRn, bi
listType_RDR, tupleType_RDR )
import RnMonad
-import Name ( Name, isLocallyDefined,
- OccName(..), occNameString, prefixOccName,
- ExportFlag(..),
- Provenance(..), getNameProvenance,
- NameSet, unionNameSets, emptyNameSet, mkNameSet, unitNameSet,
- elemNameSet, nameSetToList
+import Name ( Name, OccName(..), occNameString, prefixOccName,
+ ExportFlag(..), Provenance(..), NameSet,
+ elemNameSet
)
-import FiniteMap ( emptyFM, lookupFM, addListToFM_C )
+import FiniteMap ( lookupFM )
import Id ( GenId{-instance NamedThing-} )
-import IdInfo ( IdInfo, StrictnessInfo(..), FBTypeInfo, DemandInfo, ArgUsageInfo )
+import IdInfo ( FBTypeInfo, ArgUsageInfo )
import Lex ( isLexCon )
-import CoreUnfold ( Unfolding(..), SimpleUnfolding )
-import MagicUFs ( MagicUnfoldingFun )
import PrelInfo ( derivingOccurrences, evalClass_RDR, numClass_RDR, allClass_NAME )
-import ListSetOps ( unionLists, minusList )
-import Maybes ( maybeToBool, catMaybes )
-import Bag ( emptyBag, unitBag, consBag, unionManyBags, unionBags, listToBag, bagToList )
+import Maybes ( maybeToBool )
+import Bag ( bagToList )
import Outputable
import SrcLoc ( SrcLoc )
import Unique ( Unique )
diff --git a/ghc/compiler/simplCore/OccurAnal.lhs b/ghc/compiler/simplCore/OccurAnal.lhs
index 61ade109a8..7a4ca18995 100644
--- a/ghc/compiler/simplCore/OccurAnal.lhs
+++ b/ghc/compiler/simplCore/OccurAnal.lhs
@@ -20,11 +20,11 @@ module OccurAnal (
import BinderInfo
import CmdLineOpts ( opt_D_dump_occur_anal, SimplifierSwitch(..) )
import CoreSyn
-import Digraph ( stronglyConnComp, stronglyConnCompR, SCC(..) )
+import Digraph ( stronglyConnCompR, SCC(..) )
import Id ( idWantsToBeINLINEd, addNoInlinePragma, nukeNoInlinePragma,
idType, idUnique, Id,
emptyIdSet, unionIdSets, mkIdSet,
- unitIdSet, elementOfIdSet,
+ elementOfIdSet,
addOneToIdSet, IdSet,
nullIdEnv, unitIdEnv, combineIdEnvs,
delOneFromIdEnv, delManyFromIdEnv, isNullIdEnv,
@@ -39,9 +39,8 @@ import PprType ( GenType{-instance Outputable-}, GenTyVar{-ditto-} )
import TyVar ( GenTyVar{-instance Eq-} )
import Unique ( Unique{-instance Eq-}, u2i )
import UniqFM ( keysUFM )
-import Util ( assoc, zipEqual, zipWithEqual )
+import Util ( zipWithEqual )
import Outputable
-import List ( partition )
isSpecPragmaId_maybe x = Nothing -- ToDo:!trace "OccurAnal.isSpecPragmaId_maybe"
\end{code}
@@ -101,10 +100,12 @@ keepUnusedBinding :: OccEnv -> Id -> Bool
keepUnusedBinding (OccEnv keep_dead keep_spec keep_conjurable _ _ _) binder
= keep_dead || (keep_spec && maybeToBool (isSpecPragmaId_maybe binder))
+{- UNUSED:
keepBecauseConjurable :: OccEnv -> Id -> Bool
keepBecauseConjurable (OccEnv _ _ keep_conjurable _ _ _) binder
= False
{- keep_conjurable && isConstMethodId binder -}
+-}
type UsageDetails = IdEnv BinderInfo -- A finite map from ids to their usage
@@ -330,8 +331,6 @@ It isn't easy to do a perfect job in one blow. Consider
occAnalBind env (Rec pairs) body_usage
= foldr (_scc_ "occAnalBind.dofinal" do_final_bind) (body_usage, []) sccs
where
- pp_scc (CyclicSCC cycle) = hcat [text "Cyclic ", hcat (punctuate comma (map pp_item cycle))]
- pp_scc (AcyclicSCC item) = hcat [text "Acyclic ", pp_item item]
pp_item (_, bndr, _) = ppr bndr
binders = map fst pairs
diff --git a/ghc/compiler/simplCore/SimplEnv.lhs b/ghc/compiler/simplCore/SimplEnv.lhs
index fb5d225dcd..24872996eb 100644
--- a/ghc/compiler/simplCore/SimplEnv.lhs
+++ b/ghc/compiler/simplCore/SimplEnv.lhs
@@ -53,21 +53,17 @@ import CmdLineOpts ( switchIsOn, intSwitchSet, opt_UnfoldingCreationThreshold,
)
import CoreSyn
import CoreUnfold ( mkFormSummary, couldBeSmallEnoughToInline, whnfOrBottom,
- Unfolding(..), UfExpr, RdrName,
- SimpleUnfolding(..), FormSummary(..),
- calcUnfoldingGuidance, UnfoldingGuidance(..)
- )
-import CoreUtils ( coreExprCc, unTagBinders )
+ Unfolding(..), SimpleUnfolding(..), FormSummary(..),
+ calcUnfoldingGuidance )
+import CoreUtils ( coreExprCc )
import CostCentre ( CostCentre, subsumedCosts, noCostCentreAttached )
import FiniteMap -- lots of things
-import Id ( idType, getIdUnfolding, getIdStrictness, idWantsToBeINLINEd,
- applyTypeEnvToId, getInlinePragma,
- nullIdEnv, growIdEnvList, rngIdEnv, lookupIdEnv,
- addOneToIdEnv, modifyIdEnv, mkIdSet, modifyIdEnv_Directly,
+import Id ( applyTypeEnvToId, getInlinePragma,
+ nullIdEnv, growIdEnvList, lookupIdEnv,
+ addOneToIdEnv, modifyIdEnv, modifyIdEnv_Directly,
IdEnv, IdSet, GenId, Id )
-import Literal ( isNoRepLit, Literal{-instances-} )
-import Maybes ( maybeToBool, expectJust )
-import Name ( isLocallyDefined )
+import Literal ( Literal{-instances-} )
+import Maybes ( expectJust )
import OccurAnal ( occurAnalyseExpr )
import PprCore -- various instances
import PprType ( GenType, GenTyVar )
@@ -78,8 +74,7 @@ import TyVar ( emptyTyVarEnv, plusTyVarEnv, addToTyVarEnv, growTyVarEnvList,
)
import Unique ( Unique{-instance Outputable-}, Uniquable(..) )
import UniqFM ( addToUFM, addToUFM_C, ufmToList )
-import Util ( Eager, appEager, returnEager, runEager,
- zipEqual, thenCmp, cmpList )
+import Util ( Eager, returnEager, zipEqual, thenCmp, cmpList )
import Outputable
\end{code}
diff --git a/ghc/compiler/specialise/SpecEnv.lhs b/ghc/compiler/specialise/SpecEnv.lhs
index 168e467953..194acef471 100644
--- a/ghc/compiler/specialise/SpecEnv.lhs
+++ b/ghc/compiler/specialise/SpecEnv.lhs
@@ -13,7 +13,7 @@ module SpecEnv (
#include "HsVersions.h"
import Type ( Type, GenType, matchTys, tyVarsOfTypes )
-import TyVar ( TyVar, TyVarEnv, lookupTyVarEnv, tyVarSetToList )
+import TyVar ( TyVarEnv, lookupTyVarEnv, tyVarSetToList )
import Unify ( Subst, unifyTyListsX )
import Maybes
import Util ( assertPanic )
diff --git a/ghc/compiler/stranal/WwLib.lhs b/ghc/compiler/stranal/WwLib.lhs
index bd2ebe513c..8ef584acc9 100644
--- a/ghc/compiler/stranal/WwLib.lhs
+++ b/ghc/compiler/stranal/WwLib.lhs
@@ -15,11 +15,11 @@ module WwLib (
import CoreSyn
import Id ( GenId, idType, mkSysLocal, dataConArgTys, isDataCon, isNewCon, Id )
-import IdInfo ( mkStrictnessInfo, {-??nonAbsentArgs,-} Demand(..) )
+import IdInfo ( Demand(..) )
import PrelVals ( aBSENT_ERROR_ID, voidId )
import TysPrim ( voidTy )
import SrcLoc ( noSrcLoc )
-import Type ( isUnpointedType, mkTyVarTys, mkForAllTys, mkFunTys,
+import Type ( isUnpointedType, mkTyVarTys, mkFunTys,
splitForAllTys, splitFunTys,
splitAlgTyConApp_maybe,
Type
@@ -28,12 +28,9 @@ import TyCon ( isNewTyCon, isDataTyCon )
import BasicTypes ( NewOrData(..) )
import TyVar ( TyVar )
import PprType ( GenType, GenTyVar )
-import UniqSupply ( returnUs, thenUs, thenMaybeUs,
- getUniques, getUnique, UniqSM
- )
-import Util ( zipWithEqual, zipEqual )
+import UniqSupply ( returnUs, thenUs, getUniques, getUnique, UniqSM )
+import Util ( zipEqual )
import Outputable
-import List ( nub )
\end{code}
%************************************************************************
diff --git a/ghc/compiler/types/Class.lhs b/ghc/compiler/types/Class.lhs
index 6845415e8f..9827cabb73 100644
--- a/ghc/compiler/types/Class.lhs
+++ b/ghc/compiler/types/Class.lhs
@@ -17,14 +17,13 @@ module Class (
#include "HsVersions.h"
-import {-# SOURCE #-} Id ( Id, idType, idName )
+import {-# SOURCE #-} Id ( Id )
import {-# SOURCE #-} TyCon ( TyCon )
import {-# SOURCE #-} Type ( Type )
import {-# SOURCE #-} SpecEnv ( SpecEnv )
import TyCon ( TyCon )
import TyVar ( TyVar )
-import Maybes ( assocMaybe )
import Name ( NamedThing(..), Name, getOccName )
import Unique ( Unique, Uniquable(..) )
import BasicTypes ( Unused )
diff --git a/ghc/compiler/types/TyCon.lhs b/ghc/compiler/types/TyCon.lhs
index a2048a5ab9..0ce00b16a0 100644
--- a/ghc/compiler/types/TyCon.lhs
+++ b/ghc/compiler/types/TyCon.lhs
@@ -40,7 +40,7 @@ module TyCon(
import {-# SOURCE #-} Type ( Type )
import {-# SOURCE #-} Class ( Class )
-import {-# SOURCE #-} Id ( Id, isNullaryDataCon, idType )
+import {-# SOURCE #-} Id ( Id, isNullaryDataCon )
import {-# SOURCE #-} TysWiredIn ( tupleCon )
@@ -53,11 +53,8 @@ import Maybes
import Name ( Name, nameUnique, mkWiredInTyConName, NamedThing(getName) )
import Unique ( Unique, funTyConKey, Uniquable(..) )
import PrimRep ( PrimRep(..), isFollowableRep )
-import PrelMods ( pREL_GHC, pREL_TUP, pREL_BASE )
-import Lex ( mkTupNameStr )
-import SrcLoc ( SrcLoc, mkBuiltinSrcLoc )
-import Util ( nOfThem, isIn )
-import Outputable
+import PrelMods ( pREL_GHC )
+import Util ( panic )
\end{code}
\begin{code}
diff --git a/ghc/compiler/types/Type.lhs b/ghc/compiler/types/Type.lhs
index d84f41a5c9..0b9b29423f 100644
--- a/ghc/compiler/types/Type.lhs
+++ b/ghc/compiler/types/Type.lhs
@@ -56,8 +56,7 @@ import BasicTypes ( Unused )
import Maybes ( maybeToBool, assocMaybe )
import PrimRep ( PrimRep(..) )
import Unique -- quite a few *Keys
-import Util ( thenCmp, zipEqual, zipWithEqual, assoc )
-import Outputable
+import Util ( thenCmp, panic )
\end{code}
diff --git a/ghc/compiler/utils/Argv.lhs b/ghc/compiler/utils/Argv.lhs
index 4793b127dc..6d406a83ff 100644
--- a/ghc/compiler/utils/Argv.lhs
+++ b/ghc/compiler/utils/Argv.lhs
@@ -10,8 +10,8 @@ module Argv ( argv ) where
import FastString
-import GlaExts ( Addr )
-import ArrBase ( indexAddrOffAddr )
+import GlaExts ( Addr )
+import ByteArray ( indexAddrOffAddr )
argv :: [FAST_STRING]
argv = unpackArgv ``prog_argv'' (``prog_argc''::Int)
diff --git a/ghc/compiler/utils/Digraph.lhs b/ghc/compiler/utils/Digraph.lhs
index 15df0baa14..b904fff793 100644
--- a/ghc/compiler/utils/Digraph.lhs
+++ b/ghc/compiler/utils/Digraph.lhs
@@ -34,12 +34,16 @@ module Digraph(
#define ARR_ELT (COMMA)
-import Array
-import List
+import Util ( sortLt )
+
+-- GHC extensions
import ST
-import ArrBase
+import MutableArray
+
+-- std interfaces
import Maybe
-import Util ( sortLt )
+import Array
+import List
\end{code}
diff --git a/ghc/compiler/utils/FastString.lhs b/ghc/compiler/utils/FastString.lhs
index 1635997c99..8a2d89af6d 100644
--- a/ghc/compiler/utils/FastString.lhs
+++ b/ghc/compiler/utils/FastString.lhs
@@ -48,22 +48,31 @@ module FastString
#define COMPILING_FAST_STRING
#include "HsVersions.h"
+#if __GLASGOW_HASKELL__ < 301
import PackBase
+import STBase ( StateAndPtr#(..) )
+import IOHandle ( filePtr, readHandle, writeHandle )
+import IOBase ( Handle__(..), IOError(..), IOErrorType(..),
+ IOResult(..), IO(..),
+ constructError
+ )
+#else
+import PrelPack
+import PrelST ( StateAndPtr#(..) )
+import PrelHandle ( filePtr, readHandle, writeHandle )
+import PrelIOBase ( Handle__(..), IOError(..), IOErrorType(..),
+ IOResult(..), IO(..),
+ constructError
+ )
+#endif
+
import PrimPacked
import GlaExts
-import Addr ( Addr(..) )
-import STBase ( StateAndPtr#(..) )
-import ArrBase ( MutableArray(..) )
-import Foreign ( ForeignObj(..) )
-import IOExts ( IOArray(..), newIOArray,
- IORef, newIORef, readIORef, writeIORef
- )
+import Addr ( Addr(..) )
+import MutableArray ( MutableArray(..) )
+import Foreign ( ForeignObj(..) )
+import IOExts ( IORef, newIORef, readIORef, writeIORef )
import IO
-import IOHandle ( filePtr, readHandle, writeHandle )
-import IOBase ( Handle__(..), IOError(..), IOErrorType(..),
- IOResult(..), IO(..),
- constructError
- )
#define hASH_TBL_SIZE 993
\end{code}
@@ -458,19 +467,19 @@ hPutFS handle (FastString _ l# ba#) =
if l# ==# 0# then
return ()
else
- _readHandle handle >>= \ htype ->
+ readHandle handle >>= \ htype ->
case htype of
ErrorHandle ioError ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail ioError
ClosedHandle ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail MkIOError(handle,IllegalOperation,"handle is closed")
SemiClosedHandle _ _ ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail MkIOError(handle,IllegalOperation,"handle is closed")
ReadHandle _ _ _ ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail MkIOError(handle,IllegalOperation,"handle is not open for writing")
other ->
let fp = filePtr htype in
@@ -485,19 +494,19 @@ hPutFS handle (CharStr a# l#) =
if l# ==# 0# then
return ()
else
- _readHandle handle >>= \ htype ->
+ readHandle handle >>= \ htype ->
case htype of
ErrorHandle ioError ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail ioError
ClosedHandle ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail MkIOError(handle,IllegalOperation,"handle is closed")
SemiClosedHandle _ _ ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail MkIOError(handle,IllegalOperation,"handle is closed")
ReadHandle _ _ _ ->
- _writeHandle handle htype >>
+ writeHandle handle htype >>
fail MkIOError(handle,IllegalOperation,"handle is not open for writing")
other ->
let fp = filePtr htype in
diff --git a/ghc/compiler/utils/ListSetOps.lhs b/ghc/compiler/utils/ListSetOps.lhs
index dfa2cd023f..92cbfc56e8 100644
--- a/ghc/compiler/utils/ListSetOps.lhs
+++ b/ghc/compiler/utils/ListSetOps.lhs
@@ -13,36 +13,13 @@ module ListSetOps (
#include "HsVersions.h"
-import Util ( isIn, isn'tIn )
+import Util ( isn'tIn )
import List ( union )
\end{code}
\begin{code}
unionLists :: (Eq a) => [a] -> [a] -> [a]
-#ifdef REALLY_HASKELL_1_3
unionLists = union
-#else
-unionLists [] [] = []
-unionLists [] b = b
-unionLists a [] = a
-unionLists (a:as) b
- | a `is_elem` b = unionLists as b
- | otherwise = a : unionLists as b
- where
- is_elem = isIn "unionLists"
-#endif
-
-{- UNUSED
-intersectLists :: (Eq a) => [a] -> [a] -> [a]
-intersectLists [] [] = []
-intersectLists [] b = []
-intersectLists a [] = []
-intersectLists (a:as) b
- | a `is_elem` b = a : intersectLists as b
- | otherwise = intersectLists as b
- where
- is_elem = isIn "intersectLists"
--}
\end{code}
Everything in the first list that is not in the second list:
diff --git a/ghc/compiler/utils/OrdList.lhs b/ghc/compiler/utils/OrdList.lhs
index 223ff88422..ab683cdb58 100644
--- a/ghc/compiler/utils/OrdList.lhs
+++ b/ghc/compiler/utils/OrdList.lhs
@@ -12,8 +12,6 @@ module OrdList (
flattenOrdList
) where
-
-import Util ( mapAccumB, mapAccumL, mapAccumR )
\end{code}
This section provides an ordering list that allows fine grain
diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs
index 861f4b5f09..e09d59da17 100644
--- a/ghc/compiler/utils/Outputable.lhs
+++ b/ghc/compiler/utils/Outputable.lhs
@@ -42,7 +42,7 @@ module Outputable (
#include "HsVersions.h"
import IO ( Handle, hPutChar, hPutStr, stderr, stdout )
-import CmdLineOpts ( opt_PprStyle_All, opt_PprStyle_Debug, opt_PprStyle_User, opt_PprUserLength )
+import CmdLineOpts ( opt_PprStyle_All, opt_PprStyle_Debug, opt_PprUserLength )
import FastString
import qualified Pretty
import Pretty ( Doc, Mode(..), TextDetails(..), fullRender )
diff --git a/ghc/compiler/utils/PrimPacked.lhs b/ghc/compiler/utils/PrimPacked.lhs
index 455bf9fd29..cf36882936 100644
--- a/ghc/compiler/utils/PrimPacked.lhs
+++ b/ghc/compiler/utils/PrimPacked.lhs
@@ -32,12 +32,19 @@ module PrimPacked
import GlaExts
import Addr ( Addr(..) )
-import GHC
-import ArrBase
import ST
+import Foreign
+
+#if __GLASGOW_HASKELL__ < 301
+import ArrBase ( StateAndMutableByteArray#(..),
+ StateAndByteArray#(..) )
import STBase
-import IOBase ( ForeignObj(..) )
-import PackBase ( unpackCStringBA, packString )
+#else
+import PrelArr ( StateAndMutableByteArray#(..),
+ StateAndByteArray#(..) )
+import PrelST
+#endif
+
\end{code}
Return the length of a @\\NUL@ terminated character string:
@@ -198,9 +205,6 @@ eqCharStrPrefix a1# a2# len# =
unsafePerformIO (
_ccall_ strncmp (A# a1#) (A# a2#) (I# len#) >>= \ (I# x#) ->
return (x# ==# 0#))
- where
- bottom :: (Int,Int)
- bottom = error "eqStrPrefix"
eqStrPrefixBA :: ByteArray# -> ByteArray# -> Int# -> Int# -> Bool
eqStrPrefixBA b1# b2# start# len# =
@@ -241,14 +245,3 @@ eqStrPrefixFO fo# barr# start# len# =
bottom :: (Int,Int)
bottom = error "eqStrPrefixFO"
\end{code}
-
-\begin{code}
-byteArrayToString :: ByteArray Int -> String
-byteArrayToString = unpackCStringBA
-\end{code}
-
-
-\begin{code}
-stringToByteArray :: String -> (ByteArray Int)
-stringToByteArray = packString
-\end{code}
diff --git a/ghc/compiler/utils/SST.lhs b/ghc/compiler/utils/SST.lhs
index ac147dc920..45a8174a50 100644
--- a/ghc/compiler/utils/SST.lhs
+++ b/ghc/compiler/utils/SST.lhs
@@ -18,10 +18,18 @@ module SST(
#include "HsVersions.h"
import GlaExts
-import STBase
-import IOBase ( IO(..), IOResult(..) )
-import ArrBase
import ST
+
+#if __GLASGOW_HASKELL__ < 301
+import STBase ( ST(..), STret(..), StateAndPtr#(..) )
+import ArrBase ( StateAndMutableArray#(..) )
+import IOBase ( IO(..), IOResult(..) )
+#else
+import PrelST ( ST(..), STret(..), StateAndPtr#(..) )
+import PrelArr ( StateAndMutableArray#(..) )
+import PrelIOBase ( IO(..), IOResult(..) )
+#endif
+
\end{code}
@SST@ is very like the standard @ST@ monad, but it comes with its
diff --git a/ghc/compiler/utils/StringBuffer.lhs b/ghc/compiler/utils/StringBuffer.lhs
index 6fac2356ab..0fe695bf43 100644
--- a/ghc/compiler/utils/StringBuffer.lhs
+++ b/ghc/compiler/utils/StringBuffer.lhs
@@ -69,15 +69,22 @@ module StringBuffer
import GlaExts
import Addr ( Addr(..) )
import Foreign
-import IOBase
-import IOHandle
import ST
-import STBase
-import Char (isDigit)
-import PackBase
+import IO ( openFile, hFileSize, hClose, IOMode(..) )
+
+#if __GLASGOW_HASKELL__ < 301
+import IOBase ( IOError(..), IOErrorType(..) )
+import IOHandle ( readHandle, writeHandle, filePtr )
+import PackBase ( unpackCStringBA )
+#else
+import PrelIOBase ( IOError(..), IOErrorType(..) )
+import PrelHandle ( readHandle, writeHandle, filePtr )
+import PrelPack ( unpackCStringBA )
+#endif
+
import PrimPacked
import FastString
-
+import Char (isDigit)
\end{code}
\begin{code}
@@ -114,7 +121,7 @@ hGetStringBuffer fname =
-- makeForeignObj arr free_p >>= \ fo@(_ForeignObj fo#) ->
readHandle hndl >>= \ hndl_ ->
writeHandle hndl hndl_ >>
- let ptr = _filePtr hndl_ in
+ let ptr = filePtr hndl_ in
_ccall_ fread arr (1::Int) len_i ptr >>= \ (I# read#) ->
-- trace ("DEBUG: opened " ++ fname ++ show (I# read#)) $
hClose hndl >>
diff --git a/ghc/compiler/utils/UniqFM.lhs b/ghc/compiler/utils/UniqFM.lhs
index 2fec976bc3..08830111b7 100644
--- a/ghc/compiler/utils/UniqFM.lhs
+++ b/ghc/compiler/utils/UniqFM.lhs
@@ -49,8 +49,6 @@ import {-# SOURCE #-} Name ( Name )
import Unique ( Uniquable(..), Unique, u2i, mkUniqueGrimily )
import Util
-import Outputable ( Outputable(..) )
-import SrcLoc ( SrcLoc )
import GlaExts -- Lots of Int# operations
#if ! OMIT_NATIVE_CODEGEN
diff --git a/ghc/compiler/utils/UniqSet.lhs b/ghc/compiler/utils/UniqSet.lhs
index 13b3eae53f..5089694004 100644
--- a/ghc/compiler/utils/UniqSet.lhs
+++ b/ghc/compiler/utils/UniqSet.lhs
@@ -25,8 +25,6 @@ import {-# SOURCE #-} Name
import Maybes ( maybeToBool )
import UniqFM
import Unique ( Unique, Uniquable(..) )
-import SrcLoc ( SrcLoc )
-import Outputable ( Outputable(..) )
#if ! OMIT_NATIVE_CODEGEN
#define IF_NCG(a) a