From 49c98d143c382a1341e1046f5ca00819a25691ba Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 11 Oct 2006 12:05:17 +0000 Subject: [PATCH] Module header tidyup, phase 1 This patch is a start on removing import lists and generally tidying up the top of each module. In addition to removing import lists: - Change DATA.IOREF -> Data.IORef etc. - Change List -> Data.List etc. - Remove $Id$ - Update copyrights - Re-order imports to put non-GHC imports last - Remove some unused and duplicate imports --- compiler/HsVersions.h | 36 ------------- compiler/basicTypes/BasicTypes.lhs | 1 + compiler/basicTypes/DataCon.lhs | 31 +++++------ compiler/basicTypes/Demand.lhs | 3 +- compiler/basicTypes/Id.lhs | 52 +++++++------------ compiler/basicTypes/IdInfo.lhs | 34 ++++++------ compiler/basicTypes/Literal.lhs | 18 +++---- compiler/basicTypes/MkId.lhs | 95 +++++++++++----------------------- compiler/basicTypes/Module.lhs | 6 +-- compiler/basicTypes/Name.lhs | 22 ++++---- compiler/basicTypes/NameEnv.lhs | 5 +- compiler/basicTypes/NameSet.lhs | 5 +- compiler/basicTypes/NewDemand.lhs | 11 ++-- compiler/basicTypes/OccName.lhs | 17 +++--- compiler/basicTypes/RdrName.lhs | 16 +++--- compiler/basicTypes/SrcLoc.lhs | 9 +--- compiler/basicTypes/UniqSupply.lhs | 6 +-- compiler/basicTypes/Unique.lhs | 12 ++--- compiler/basicTypes/Var.lhs | 10 ++-- compiler/basicTypes/VarEnv.lhs | 16 +++--- compiler/basicTypes/VarSet.lhs | 8 +-- compiler/cmm/CLabel.hs | 22 ++++---- compiler/cmm/Cmm.hs | 13 ++--- compiler/cmm/CmmLex.x | 5 +- compiler/cmm/CmmLint.hs | 12 ++--- compiler/cmm/CmmOpt.hs | 18 +++---- compiler/cmm/CmmParse.y | 36 ++++++------- compiler/cmm/CmmUtils.hs | 4 +- compiler/cmm/MachOp.hs | 2 +- compiler/cmm/PprC.hs | 22 ++++---- compiler/cmm/PprCmm.hs | 22 ++++---- compiler/codeGen/Bitmap.hs | 5 +- compiler/codeGen/CgBindery.lhs | 31 ++++++----- compiler/codeGen/CgCallConv.hs | 49 ++++++++---------- compiler/codeGen/CgCase.lhs | 70 ++++++++++--------------- compiler/codeGen/CgClosure.lhs | 50 ++++++++---------- compiler/codeGen/CgCon.lhs | 51 ++++++++---------- compiler/codeGen/CgExpr.lhs | 67 ++++++++++-------------- compiler/codeGen/CgForeignCall.hs | 18 +++---- compiler/codeGen/CgHeapery.lhs | 55 ++++++++------------ compiler/codeGen/CgInfoTbls.hs | 51 +++++++----------- compiler/codeGen/CgLetNoEscape.lhs | 33 ++++++------ compiler/codeGen/CgMonad.lhs | 29 +++++------ compiler/codeGen/CgParallel.hs | 14 +++-- compiler/codeGen/CgPrimOp.hs | 25 +++++---- compiler/codeGen/CgProf.hs | 31 ++++++----- compiler/codeGen/CgStackery.lhs | 17 +++--- compiler/codeGen/CgTailCall.lhs | 41 ++++++--------- compiler/codeGen/CgTicky.hs | 36 ++++++------- compiler/codeGen/CgUtils.hs | 39 +++++++------- compiler/codeGen/ClosureInfo.lhs | 29 +++++------ compiler/codeGen/CodeGen.lhs | 55 +++++++++----------- compiler/codeGen/SMRep.lhs | 17 +++--- compiler/coreSyn/CoreFVs.lhs | 20 +++---- compiler/coreSyn/CoreLint.lhs | 49 +++++++----------- compiler/coreSyn/CorePrep.lhs | 37 ++++++------- compiler/coreSyn/CoreSubst.lhs | 43 +++++++-------- compiler/coreSyn/CoreSyn.lhs | 24 +++++---- compiler/coreSyn/CoreTidy.lhs | 34 ++++++------ compiler/coreSyn/CoreUnfold.lhs | 35 ++++++------- compiler/coreSyn/CoreUtils.lhs | 80 ++++++++++++---------------- compiler/coreSyn/ExternalCore.lhs | 2 +- compiler/coreSyn/MkExternalCore.lhs | 13 +++-- compiler/coreSyn/PprCore.lhs | 46 ++++++---------- compiler/coreSyn/PprExternalCore.lhs | 6 +-- compiler/cprAnalysis/CprAnalyse.lhs | 17 +++--- compiler/deSugar/Check.lhs | 33 +++++------- compiler/deSugar/Desugar.lhs | 57 ++++++++++---------- compiler/deSugar/DsArrows.lhs | 53 ++++++++----------- compiler/deSugar/DsBinds.lhs | 42 ++++++++------- compiler/deSugar/DsCCall.lhs | 65 ++++++++--------------- compiler/deSugar/DsExpr.lhs | 77 +++++++++++++-------------- compiler/deSugar/DsForeign.lhs | 65 +++++++++-------------- compiler/deSugar/DsGRHSs.lhs | 25 ++++----- compiler/deSugar/DsListComp.lhs | 36 ++++++------- compiler/deSugar/DsMeta.hs | 61 +++++++++++----------- compiler/deSugar/DsMonad.lhs | 45 ++++++++-------- compiler/deSugar/DsUtils.lhs | 58 ++++++++++----------- compiler/deSugar/Match.lhs | 48 ++++++++--------- compiler/deSugar/MatchCon.lhs | 22 ++++---- compiler/deSugar/MatchLit.lhs | 35 +++++++------ compiler/deSugar/deSugar.tex | 23 -------- compiler/iface/BinIface.hs | 49 +++++++----------- compiler/iface/BuildTyCl.lhs | 43 ++++++--------- compiler/iface/IfaceEnv.lhs | 48 ++++++----------- compiler/iface/IfaceSyn.lhs | 34 +++++------- compiler/iface/IfaceType.lhs | 23 ++++---- compiler/iface/LoadIface.lhs | 77 +++++++++++---------------- compiler/iface/MkIface.lhs | 89 ++++++++++--------------------- compiler/iface/TcIface.lhs | 94 ++++++++++++++------------------- compiler/main/HscMain.lhs | 7 +-- compiler/main/HscTypes.lhs | 5 +- compiler/main/TidyPgm.lhs | 7 +-- compiler/ndpFlatten/Flattening.hs | 2 +- compiler/prelude/PrelRules.lhs | 6 +-- compiler/prelude/TysPrim.lhs | 5 +- compiler/simplCore/SimplMonad.lhs | 2 +- compiler/typecheck/FamInst.lhs | 22 ++++---- compiler/typecheck/Inst.lhs | 87 ++++++++++++------------------- compiler/typecheck/TcArrows.lhs | 43 +++++++-------- compiler/typecheck/TcBinds.lhs | 69 +++++++++--------------- compiler/typecheck/TcClassDcl.lhs | 83 +++++++++++++---------------- compiler/typecheck/TcDefaults.lhs | 17 +++--- compiler/typecheck/TcDeriv.lhs | 72 +++++++++++--------------- compiler/typecheck/TcEnv.lhs | 49 ++++++++---------- compiler/typecheck/TcRnMonad.lhs | 90 +++++++++++++++----------------- compiler/typecheck/TcTyDecls.lhs | 30 +++++------ compiler/typecheck/TcType.lhs | 46 ++-------------- 108 files changed, 1541 insertions(+), 2091 deletions(-) delete mode 100644 compiler/deSugar/deSugar.tex diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h index dd80922..68884c0 100644 --- a/compiler/HsVersions.h +++ b/compiler/HsVersions.h @@ -22,42 +22,6 @@ you will screw up the layout where they are used in case expressions! * settings for the target plat instead). */ #include "../includes/ghcautoconf.h" -#if __GLASGOW_HASKELL__ >= 504 - -#define CONCURRENT Control.Concurrent -#define EXCEPTION Control.Exception - /* If you want Control.Exception.try, get it as Panic.try, which - deals with the shift from 'tryAllIO' to 'try'. */ -#define DYNAMIC Data.Dynamic -#define GLAEXTS GHC.Exts -#define DATA_BITS Data.Bits -#define DATA_INT Data.Int -#define DATA_WORD Data.Word -#define UNSAFE_IO System.IO.Unsafe -#define TRACE Debug.Trace -#define DATA_IOREF Data.IORef -#define FIX_IO System.IO -#define MONAD_ST Control.Monad.ST -#define ST_ARRAY Data.Array.ST - -#else - -#define CONCURRENT Concurrent -#define EXCEPTION Exception -#define DYNAMIC Dynamic -#define GLAEXTS GlaExts -#define DATA_BITS Bits -#define DATA_INT Int -#define DATA_WORD Word -#define UNSAFE_IO IOExts -#define TRACE IOExts -#define DATA_IOREF IOExts -#define FIX_IO IOExts -#define MONAD_ST ST -#define ST_ARRAY ST - -#endif - #ifdef __GLASGOW_HASKELL__ #define GLOBAL_VAR(name,value,ty) \ name = Util.global (value) :: IORef (ty); \ diff --git a/compiler/basicTypes/BasicTypes.lhs b/compiler/basicTypes/BasicTypes.lhs index c43280f..278a284 100644 --- a/compiler/basicTypes/BasicTypes.lhs +++ b/compiler/basicTypes/BasicTypes.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1997-1998 % \section[BasicTypes]{Miscellanous types} diff --git a/compiler/basicTypes/DataCon.lhs b/compiler/basicTypes/DataCon.lhs index 8829128..b2e166b 100644 --- a/compiler/basicTypes/DataCon.lhs +++ b/compiler/basicTypes/DataCon.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1998 % \section[DataCon]{@DataCon@: Data Constructors} @@ -29,26 +30,18 @@ module DataCon ( #include "HsVersions.h" -import Type ( Type, ThetaType, - substTyWith, substTyVar, mkTopTvSubst, - mkForAllTys, mkFunTys, mkTyConApp, mkTyVarTy, mkTyVarTys, - splitTyConApp_maybe, newTyConInstRhs, - mkPredTys, isStrictPred, pprType - ) -import Coercion ( isEqPred, mkEqPred ) -import TyCon ( TyCon, FieldLabel, tyConDataCons, - isProductTyCon, isTupleTyCon, isUnboxedTupleTyCon, - isNewTyCon, isClosedNewTyCon, isRecursiveTyCon, - tyConFamInst_maybe ) -import Class ( Class, classTyCon ) -import Name ( Name, NamedThing(..), nameUnique ) -import Var ( TyVar, Id ) -import BasicTypes ( Arity, StrictnessMark(..) ) +import Type +import Coercion +import TyCon +import Class +import Name +import Var +import BasicTypes import Outputable -import Unique ( Unique, Uniquable(..) ) -import ListSetOps ( assoc, minusList ) -import Util ( zipEqual, zipWithEqual ) -import Maybes ( expectJust ) +import Unique +import ListSetOps +import Util +import Maybes import FastString \end{code} diff --git a/compiler/basicTypes/Demand.lhs b/compiler/basicTypes/Demand.lhs index 50bb0c6..78b46a7 100644 --- a/compiler/basicTypes/Demand.lhs +++ b/compiler/basicTypes/Demand.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[Demand]{@Demand@: the amount of demand on a value} @@ -27,7 +28,7 @@ module Demand( #include "HsVersions.h" import Outputable -import Util ( listLengthCmp ) +import Util \end{code} diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs index c9c503d..edaeb7a 100644 --- a/compiler/basicTypes/Id.lhs +++ b/compiler/basicTypes/Id.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[Id]{@Ids@: Value and constructor identifiers} @@ -79,42 +80,29 @@ module Id ( #include "HsVersions.h" - -import CoreSyn ( Unfolding, CoreRule ) -import BasicTypes ( Arity ) -import Var ( Id, DictId, - isId, isExportedId, isLocalId, - idName, idType, idUnique, idInfo, isGlobalId, - setIdName, setIdType, setIdUnique, - setIdExported, setIdNotExported, - setIdInfo, lazySetIdInfo, modifyIdInfo, - maybeModifyIdInfo, - globalIdDetails - ) -import qualified Var ( mkLocalId, mkGlobalId, mkExportedLocalId ) -import TyCon ( FieldLabel, TyCon ) -import Type ( Type, typePrimRep, addFreeTyVars, seqType, - splitTyConApp_maybe, PrimRep ) -import TcType ( isDictTy ) -import TysPrim ( statePrimTyCon ) +import CoreSyn +import BasicTypes +import qualified Var +import Var hiding (mkLocalId, mkGlobalId, mkExportedLocalId) +import TyCon +import Type +import TcType +import TysPrim import IdInfo - #ifdef OLD_STRICTNESS -import qualified Demand ( Demand ) +import qualified Demand #endif -import DataCon ( DataCon, isUnboxedTupleCon ) -import NewDemand ( Demand, StrictSig, topDmd, topSig, isBottomingSig ) -import Name ( Name, OccName, nameIsLocalOrFrom, - mkSystemVarName, mkInternalName, getOccName, - getSrcLoc ) -import Module ( Module ) -import OccName ( mkWorkerOcc ) -import Maybes ( orElse ) -import SrcLoc ( SrcLoc ) +import DataCon +import NewDemand +import Name +import Module +import OccName +import Maybes +import SrcLoc import Outputable -import Unique ( Unique, mkBuiltinUnique ) -import FastString ( FastString ) -import StaticFlags ( opt_NoStateHack ) +import Unique +import FastString +import StaticFlags -- infixl so you can say (id `set` a `set` b) infixl 1 `setIdUnfolding`, diff --git a/compiler/basicTypes/IdInfo.lhs b/compiler/basicTypes/IdInfo.lhs index d53bf56..9db8e35 100644 --- a/compiler/basicTypes/IdInfo.lhs +++ b/compiler/basicTypes/IdInfo.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % \section[IdInfo]{@IdInfos@: Non-essential information about @Ids@} @@ -75,31 +76,26 @@ module IdInfo ( #include "HsVersions.h" - import CoreSyn -import Class ( Class ) -import PrimOp ( PrimOp ) -import Var ( Id ) -import VarSet ( VarSet, emptyVarSet, seqVarSet ) -import BasicTypes ( OccInfo(..), isFragileOcc, isDeadOcc, seqOccInfo, isLoopBreaker, - InsideLam, insideLam, notInsideLam, - OneBranch, oneBranch, notOneBranch, - Arity, - Activation(..) - ) -import DataCon ( DataCon ) -import TyCon ( TyCon, FieldLabel ) -import ForeignCall ( ForeignCall ) +import Class +import PrimOp +import Var +import VarSet +import BasicTypes +import DataCon +import TyCon +import ForeignCall import NewDemand import Outputable -import Maybe ( isJust ) + +import Data.Maybe #ifdef OLD_STRICTNESS -import Name ( Name ) -import Demand hiding( Demand, seqDemand ) +import Name +import Demand import qualified Demand -import Util ( listLengthCmp ) -import List ( replicate ) +import Util +import Data.List #endif -- infixl so you can say (id `set` a `set` b) diff --git a/compiler/basicTypes/Literal.lhs b/compiler/basicTypes/Literal.lhs index e83ea9d..f05d1bf 100644 --- a/compiler/basicTypes/Literal.lhs +++ b/compiler/basicTypes/Literal.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1998 % \section[Literal]{@Literal@: Machine literals (unboxed, of course)} @@ -26,24 +27,21 @@ module Literal #include "HsVersions.h" -import TysPrim ( charPrimTy, addrPrimTy, floatPrimTy, doublePrimTy, - intPrimTy, wordPrimTy, int64PrimTy, word64PrimTy - ) -import Type ( Type ) +import TysPrim +import Type import Outputable import FastTypes import FastString import Binary +import Ratio +import FastString -import Ratio ( numerator ) -import FastString ( uniqueOfFS, lengthFS ) -import DATA_INT ( Int8, Int16, Int32 ) -import DATA_WORD ( Word8, Word16, Word32 ) -import Char ( ord, chr ) +import Data.Int +import Data.Word +import Data.Char \end{code} - %************************************************************************ %* * \subsection{Sizes} diff --git a/compiler/basicTypes/MkId.lhs b/compiler/basicTypes/MkId.lhs index 9818eba..fd4e3e2 100644 --- a/compiler/basicTypes/MkId.lhs +++ b/compiler/basicTypes/MkId.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1998 % -\section[StdIdInfo]{Standard unfoldings} This module contains definitions for the IdInfo for things that have a standard form, namely: @@ -38,71 +38,40 @@ module MkId ( #include "HsVersions.h" - -import BasicTypes ( Arity, StrictnessMark(..), isMarkedUnboxed, isMarkedStrict ) -import Rules ( mkSpecInfo ) -import TysPrim ( openAlphaTyVars, alphaTyVar, alphaTy, - realWorldStatePrimTy, addrPrimTy - ) -import TysWiredIn ( charTy, mkListTy ) -import PrelRules ( primOpRules ) -import Type ( TyThing(..), mkForAllTy, tyVarsOfTypes, - newTyConInstRhs, mkTopTvSubst, substTyVar, - substTys, zipTopTvSubst ) -import TcGadt ( gadtRefine, refineType, emptyRefinement ) -import HsBinds ( HsWrapper(..), isIdHsWrapper ) -import Coercion ( mkSymCoercion, mkUnsafeCoercion, isEqPred ) -import TcType ( Type, ThetaType, mkDictTy, mkPredTys, mkPredTy, - mkTyConApp, mkTyVarTys, mkClassPred, isPredTy, - mkFunTys, mkFunTy, mkSigmaTy, tcSplitSigmaTy, tcEqType, - isUnLiftedType, mkForAllTys, mkTyVarTy, tyVarsOfType, - tcSplitFunTys, tcSplitForAllTys, dataConsStupidTheta - ) -import CoreUtils ( exprType, dataConOrigInstPat, mkCoerce ) -import CoreUnfold ( mkTopUnfolding, mkCompulsoryUnfolding ) -import Literal ( nullAddrLit, mkStringLit ) -import TyCon ( TyCon, isNewTyCon, tyConTyVars, tyConDataCons, - FieldLabel, - tyConStupidTheta, isProductTyCon, isDataTyCon, - isRecursiveTyCon, isFamInstTyCon, - tyConFamInst_maybe, tyConFamilyCoercion_maybe, - newTyConCo_maybe ) -import Class ( Class, classTyCon, classSelIds ) -import Var ( Id, TyVar, Var, setIdType ) -import VarSet ( isEmptyVarSet, subVarSet, varSetElems ) -import Name ( mkFCallName, mkWiredInName, Name, BuiltInSyntax(..)) -import OccName ( mkOccNameFS, varName ) -import PrimOp ( PrimOp, primOpSig, primOpOcc, primOpTag ) -import ForeignCall ( ForeignCall ) -import DataCon ( DataCon, DataConIds(..), dataConTyCon, - dataConUnivTyVars, - dataConFieldLabels, dataConRepArity, dataConResTys, - dataConRepArgTys, dataConRepType, dataConFullSig, - dataConStrictMarks, dataConExStricts, - splitProductType, isVanillaDataCon, dataConFieldType, - deepSplitProductType, - ) -import Id ( idType, mkGlobalId, mkVanillaGlobal, mkSysLocal, - mkTemplateLocals, mkTemplateLocalsNum, mkExportedLocalId, - mkTemplateLocal, idName - ) -import IdInfo ( IdInfo, noCafIdInfo, setUnfoldingInfo, - setArityInfo, setSpecInfo, setCafInfo, - setAllStrictnessInfo, vanillaIdInfo, - GlobalIdDetails(..), CafInfo(..) - ) -import NewDemand ( mkStrictSig, DmdResult(..), - mkTopDmdType, topDmd, evalDmd, lazyDmd, retCPR, - Demand(..), Demands(..) ) -import DmdAnal ( dmdAnalTopRhs ) +import Rules +import TysPrim +import TysWiredIn +import PrelRules +import Type +import TcGadt +import HsBinds +import Coercion +import TcType +import CoreUtils +import CoreUnfold +import Literal +import TyCon +import Class +import VarSet +import Name +import OccName +import PrimOp +import ForeignCall +import DataCon +import Id +import Var ( Var, TyVar) +import IdInfo +import NewDemand +import DmdAnal import CoreSyn -import Unique ( mkBuiltinUnique, mkPrimOpIdUnique ) +import Unique import Maybes import PrelNames -import Util ( dropList, isSingleton ) +import BasicTypes hiding ( SuccessFlag(..) ) +import Util import Outputable import FastString -import ListSetOps ( assoc, minusList ) +import ListSetOps \end{code} %************************************************************************ @@ -1226,9 +1195,5 @@ pc_bottoming_Id name ty strict_sig = mkStrictSig (mkTopDmdType [evalDmd] BotRes) -- These "bottom" out, no matter what their arguments - -(openAlphaTyVar:openBetaTyVar:_) = openAlphaTyVars -openAlphaTy = mkTyVarTy openAlphaTyVar -openBetaTy = mkTyVarTy openBetaTyVar \end{code} diff --git a/compiler/basicTypes/Module.lhs b/compiler/basicTypes/Module.lhs index 720c51f..ba0459d 100644 --- a/compiler/basicTypes/Module.lhs +++ b/compiler/basicTypes/Module.lhs @@ -1,5 +1,5 @@ % -% (c) The University of Glasgow, 2004 +% (c) The University of Glasgow, 2004-2006 % Module @@ -48,10 +48,10 @@ module Module #include "HsVersions.h" import Outputable -import Unique ( Uniquable(..) ) +import Unique import FiniteMap import UniqFM -import PackageConfig ( PackageId, packageIdFS, mainPackageId ) +import PackageConfig import FastString import Binary \end{code} diff --git a/compiler/basicTypes/Name.lhs b/compiler/basicTypes/Name.lhs index df97181..feda0b1 100644 --- a/compiler/basicTypes/Name.lhs +++ b/compiler/basicTypes/Name.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[Name]{@Name@: to transmit name info from renamer to typechecker} @@ -37,21 +38,20 @@ module Name ( import {-# SOURCE #-} TypeRep( TyThing ) -import OccName -- All of it -import Module ( Module ) -import SrcLoc ( noSrcLoc, wiredInSrcLoc, SrcLoc ) -import UniqFM ( lookupUFM, addToUFM ) -import Unique ( Unique, Uniquable(..), getKey, pprUnique, - mkUniqueGrimily, getKey# ) -import Maybes ( orElse, isJust ) +import OccName +import Module +import SrcLoc +import UniqFM +import Unique +import Maybes import Binary import FastMutInt -import FastString ( FastString, zEncodeFS ) +import FastString import Outputable -import DATA_IOREF -import GLAEXTS ( Int#, Int(..) ) -import Data.Array ( (!) ) +import Data.IORef +import GHC.Exts +import Data.Array \end{code} %************************************************************************ diff --git a/compiler/basicTypes/NameEnv.lhs b/compiler/basicTypes/NameEnv.lhs index 561aeb6..6255e73 100644 --- a/compiler/basicTypes/NameEnv.lhs +++ b/compiler/basicTypes/NameEnv.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[NameEnv]{@NameEnv@: name environments} @@ -17,9 +18,9 @@ module NameEnv ( #include "HsVersions.h" -import Name ( Name ) +import Name import UniqFM -import Maybes ( expectJust ) +import Maybes \end{code} %************************************************************************ diff --git a/compiler/basicTypes/NameSet.lhs b/compiler/basicTypes/NameSet.lhs index 2100fc5..5c2c1b8 100644 --- a/compiler/basicTypes/NameSet.lhs +++ b/compiler/basicTypes/NameSet.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1998 % -\section[NameSet]{@NameSets@} \begin{code} module NameSet ( @@ -28,7 +28,6 @@ import Name import UniqSet \end{code} - %************************************************************************ %* * \subsection[Sets of names} @@ -187,4 +186,4 @@ findUses dus uses = rhs_uses `unionNameSets` uses | otherwise -- No def is used = uses -\end{code} \ No newline at end of file +\end{code} diff --git a/compiler/basicTypes/NewDemand.lhs b/compiler/basicTypes/NewDemand.lhs index 8e68fd8..6da4c47 100644 --- a/compiler/basicTypes/NewDemand.lhs +++ b/compiler/basicTypes/NewDemand.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[Demand]{@Demand@: the amount of demand on a value} @@ -24,11 +25,11 @@ module NewDemand( #include "HsVersions.h" -import StaticFlags ( opt_CprOff ) -import BasicTypes ( Arity ) -import VarEnv ( VarEnv, emptyVarEnv, isEmptyVarEnv ) -import UniqFM ( ufmToList ) -import Util ( listLengthCmp, zipWithEqual ) +import StaticFlags +import BasicTypes +import VarEnv +import UniqFM +import Util import Outputable \end{code} diff --git a/compiler/basicTypes/OccName.lhs b/compiler/basicTypes/OccName.lhs index 0d1cb37..92351d6 100644 --- a/compiler/basicTypes/OccName.lhs +++ b/compiler/basicTypes/OccName.lhs @@ -1,10 +1,8 @@ -{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-} % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[OccName]{@OccName@} - \begin{code} module OccName ( -- * The NameSpace type; abstact @@ -65,19 +63,18 @@ module OccName ( #include "HsVersions.h" -import Util ( thenCmp ) -import Unique ( Unique, mkUnique, Uniquable(..) ) -import BasicTypes ( Boxity(..), Arity ) -import StaticFlags ( opt_PprStyle_Debug ) +import Util +import Unique +import BasicTypes +import StaticFlags import UniqFM import UniqSet import FastString import Outputable import Binary -import GLAEXTS - -import Data.Char ( isUpper, isLower, ord ) +import GHC.Exts +import Data.Char -- Unicode TODO: put isSymbol in libcompat #if __GLASGOW_HASKELL__ > 604 diff --git a/compiler/basicTypes/RdrName.lhs b/compiler/basicTypes/RdrName.lhs index 2f7f7a8..ad1256d 100644 --- a/compiler/basicTypes/RdrName.lhs +++ b/compiler/basicTypes/RdrName.lhs @@ -1,9 +1,8 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[RdrName]{@RdrName@} - \begin{code} module RdrName ( RdrName(..), -- Constructors exported only to BinIface @@ -41,14 +40,13 @@ module RdrName ( #include "HsVersions.h" import OccName -import Module ( ModuleName, mkModuleNameFS, Module, moduleName ) -import Name ( Name, NamedThing(getName), nameModule, - nameOccName, isExternalName, nameSrcLoc ) -import Maybes ( mapCatMaybes ) -import SrcLoc ( isGoodSrcLoc, isGoodSrcSpan, srcLocSpan, SrcSpan ) -import FastString ( FastString ) +import Module +import Name +import Maybes +import SrcLoc +import FastString import Outputable -import Util ( thenCmp ) +import Util \end{code} %************************************************************************ diff --git a/compiler/basicTypes/SrcLoc.lhs b/compiler/basicTypes/SrcLoc.lhs index 2dc6c48..52c4717 100644 --- a/compiler/basicTypes/SrcLoc.lhs +++ b/compiler/basicTypes/SrcLoc.lhs @@ -1,11 +1,6 @@ % -% (c) The University of Glasgow, 1992-2003 +% (c) The University of Glasgow, 1992-2006 % -%************************************************************************ -%* * -\section[SrcLoc]{The @SrcLoc@ type} -%* * -%************************************************************************ \begin{code} module SrcLoc ( @@ -42,7 +37,7 @@ module SrcLoc ( #include "HsVersions.h" -import Util ( thenCmp ) +import Util import Outputable import FastString \end{code} diff --git a/compiler/basicTypes/UniqSupply.lhs b/compiler/basicTypes/UniqSupply.lhs index 05b565f..7937043 100644 --- a/compiler/basicTypes/UniqSupply.lhs +++ b/compiler/basicTypes/UniqSupply.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[UniqSupply]{The @UniqueSupply@ data type and a (monadic) supply thereof} \begin{code} module UniqSupply ( @@ -25,8 +25,8 @@ module UniqSupply ( import Unique -import GLAEXTS -import UNSAFE_IO ( unsafeInterleaveIO ) +import GHC.Exts +import System.IO.Unsafe ( unsafeInterleaveIO ) w2i x = word2Int# x i2w x = int2Word# x diff --git a/compiler/basicTypes/Unique.lhs b/compiler/basicTypes/Unique.lhs index 8743288..058b0be 100644 --- a/compiler/basicTypes/Unique.lhs +++ b/compiler/basicTypes/Unique.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % @@ -49,15 +50,14 @@ module Unique ( #include "HsVersions.h" -import BasicTypes ( Boxity(..) ) -import PackageConfig ( PackageId, packageIdFS ) -import FastString ( FastString, uniqueOfFS ) +import BasicTypes +import PackageConfig +import FastString import Outputable import FastTypes -import GLAEXTS - -import Char ( chr, ord ) +import GHC.Exts +import Data.Char ( chr, ord ) \end{code} %************************************************************************ diff --git a/compiler/basicTypes/Var.lhs b/compiler/basicTypes/Var.lhs index faf32d7..3510828 100644 --- a/compiler/basicTypes/Var.lhs +++ b/compiler/basicTypes/Var.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section{@Vars@: Variables} @@ -37,11 +38,10 @@ module Var ( import {-# SOURCE #-} TypeRep( Type, Kind ) import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails ) -import {-# SOURCE #-} IdInfo( GlobalIdDetails, notGlobalId, IdInfo, seqIdInfo ) - -import Name ( Name, NamedThing(..), setNameUnique, nameUnique, mkSysTvName ) -import Unique ( Unique, Uniquable(..), mkUniqueGrimily, getKey#, - mkBuiltinUnique ) +import {-# SOURCE #-} IdInfo( GlobalIdDetails, notGlobalId, + IdInfo, seqIdInfo ) +import Name hiding (varName) +import Unique import FastTypes import FastString import Outputable diff --git a/compiler/basicTypes/VarEnv.lhs b/compiler/basicTypes/VarEnv.lhs index e59c800..3c9f53a 100644 --- a/compiler/basicTypes/VarEnv.lhs +++ b/compiler/basicTypes/VarEnv.lhs @@ -1,7 +1,7 @@ - +% +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section{@VarEnvs@: Variable environments} \begin{code} module VarEnv ( @@ -36,14 +36,14 @@ module VarEnv ( #include "HsVersions.h" -import OccName ( TidyOccEnv, emptyTidyOccEnv ) -import Var ( Var, setVarUnique ) +import OccName +import Var import VarSet import UniqFM -import Unique ( Unique, deriveUnique, getUnique ) -import Util ( zipEqual, foldl2 ) -import Maybes ( orElse ) -import StaticFlags( opt_PprStyle_Debug ) +import Unique +import Util +import Maybes +import StaticFlags import Outputable import FastTypes \end{code} diff --git a/compiler/basicTypes/VarSet.lhs b/compiler/basicTypes/VarSet.lhs index 812213d..7e08d9d 100644 --- a/compiler/basicTypes/VarSet.lhs +++ b/compiler/basicTypes/VarSet.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section{@VarSet@: Variable sets} \begin{code} module VarSet ( @@ -19,10 +19,10 @@ module VarSet ( #include "HsVersions.h" -import Var ( Var, Id, TyVar ) -import Unique ( Unique ) +import Var +import Unique import UniqSet -import UniqFM ( delFromUFM_Directly, addToUFM_C ) +import UniqFM \end{code} %************************************************************************ diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index a93fba5..f6c5148 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -2,7 +2,7 @@ -- -- Object-file symbols (called CLabel for histerical raisins). -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -103,16 +103,16 @@ module CLabel ( #include "HsVersions.h" -import StaticFlags ( opt_Static, opt_DoTickyProfiling ) -import Packages ( isDllName ) -import DataCon ( ConTag ) -import PackageConfig ( PackageId ) -import Module ( Module, modulePackageId ) -import Name ( Name, isExternalName ) -import Unique ( pprUnique, Unique ) -import PrimOp ( PrimOp ) -import Config ( cLeadingUnderscore ) -import CostCentre ( CostCentre, CostCentreStack ) +import StaticFlags +import Packages +import DataCon +import PackageConfig +import Module +import Name +import Unique +import PrimOp +import Config +import CostCentre import Outputable import FastString diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs index 13961c1..d30f963 100644 --- a/compiler/cmm/Cmm.hs +++ b/compiler/cmm/Cmm.hs @@ -2,7 +2,7 @@ -- -- Cmm data types -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -26,11 +26,12 @@ module Cmm ( #include "HsVersions.h" import MachOp -import CLabel ( CLabel ) -import ForeignCall ( CCallConv ) -import Unique ( Unique, Uniquable(..) ) -import FastString ( FastString ) -import DATA_WORD ( Word8 ) +import CLabel +import ForeignCall +import Unique +import FastString + +import Data.Word ----------------------------------------------------------------------------- -- Cmm, CmmTop, CmmBasicBlock diff --git a/compiler/cmm/CmmLex.x b/compiler/cmm/CmmLex.x index 2bf4ff3..fb1179f 100644 --- a/compiler/cmm/CmmLex.x +++ b/compiler/cmm/CmmLex.x @@ -1,5 +1,6 @@ ----------------------------------------------------------------------------- --- (c) The University of Glasgow, 2004 +-- +-- (c) The University of Glasgow, 2004-2006 -- -- Lexer for concrete Cmm. We try to stay close to the C-- spec, but there -- are a few minor differences: @@ -24,7 +25,7 @@ import UniqFM import StringBuffer import FastString import Ctype -import Util ( readRational ) +import Util --import TRACE } diff --git a/compiler/cmm/CmmLint.hs b/compiler/cmm/CmmLint.hs index 83444e5..80ad9ef 100644 --- a/compiler/cmm/CmmLint.hs +++ b/compiler/cmm/CmmLint.hs @@ -1,8 +1,8 @@ ----------------------------------------------------------------------------- -- --- CmmLint: checking the correctness of Cmm statements and expressions +-- (c) The University of Glasgow 2004-2006 -- --- (c) The University of Glasgow 2004 +-- CmmLint: checking the correctness of Cmm statements and expressions -- ----------------------------------------------------------------------------- @@ -13,14 +13,14 @@ module CmmLint ( #include "HsVersions.h" import Cmm -import CLabel ( pprCLabel ) +import CLabel import MachOp import Outputable import PprCmm -import Unique ( getUnique ) -import Constants ( wORD_SIZE ) +import Unique +import Constants -import Monad ( when ) +import Control.Monad -- ----------------------------------------------------------------------------- -- Exported entry points: diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index a23a46f..f279b84 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -15,22 +15,20 @@ module CmmOpt ( #include "HsVersions.h" import Cmm -import CmmUtils ( hasNoGlobalRegs ) -import CLabel ( entryLblToInfoLbl ) +import CmmUtils +import CLabel import MachOp -import SMRep ( tablesNextToCode ) +import SMRep import UniqFM -import Unique ( Unique ) -import Panic ( panic ) +import Unique import Outputable -import Bits -import Word -import Int -import GLAEXTS - +import Data.Bits +import Data.Word +import Data.Int +import GHC.Exts -- ----------------------------------------------------------------------------- -- The mini-inliner diff --git a/compiler/cmm/CmmParse.y b/compiler/cmm/CmmParse.y index a1cbbf5..05ec274 100644 --- a/compiler/cmm/CmmParse.y +++ b/compiler/cmm/CmmParse.y @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------- -- --- (c) The University of Glasgow, 2004 +-- (c) The University of Glasgow, 2004-2006 -- -- Parser for concrete Cmm. -- @@ -16,37 +16,37 @@ import CgProf import CgTicky import CgInfoTbls import CgForeignCall -import CgTailCall ( pushUnboxedTuple ) -import CgStackery ( emitPushUpdateFrame ) -import ClosureInfo ( C_SRT(..) ) -import CgCallConv ( smallLiveness ) -import CgClosure ( emitBlackHoleCode ) -import CostCentre ( dontCareCCS ) +import CgTailCall +import CgStackery +import ClosureInfo +import CgCallConv +import CgClosure +import CostCentre import Cmm import PprCmm -import CmmUtils ( mkIntCLit ) +import CmmUtils import CmmLex import CLabel import MachOp -import SMRep ( fixedHdrSize, CgRep(..) ) +import SMRep import Lexer -import ForeignCall ( CCallConv(..), Safety(..) ) -import Literal ( mkMachInt ) +import ForeignCall +import Literal import Unique import UniqFM import SrcLoc -import DynFlags ( DynFlags, DynFlag(..) ) -import StaticFlags ( opt_SccProfilingOn ) -import ErrUtils ( printError, dumpIfSet_dyn, showPass ) -import StringBuffer ( hGetStringBuffer ) +import DynFlags +import StaticFlags +import ErrUtils +import StringBuffer import FastString -import Panic ( panic ) -import Constants ( wORD_SIZE ) +import Panic +import Constants import Outputable -import Monad ( when ) +import Control.Monad ( when ) import Data.Char ( ord ) #include "HsVersions.h" diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs index a04935b..0c5ab0f 100644 --- a/compiler/cmm/CmmUtils.hs +++ b/compiler/cmm/CmmUtils.hs @@ -2,7 +2,7 @@ -- -- Cmm utilities. -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -22,7 +22,7 @@ module CmmUtils( #include "HsVersions.h" -import CLabel ( CLabel ) +import CLabel import Cmm import MachOp import OrdList diff --git a/compiler/cmm/MachOp.hs b/compiler/cmm/MachOp.hs index a77a7b1..afe834a 100644 --- a/compiler/cmm/MachOp.hs +++ b/compiler/cmm/MachOp.hs @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------- -- --- (c) The University of Glasgow 2002-2004 +-- (c) The University of Glasgow 2002-2006 -- -- Low-level machine operations, used in the Cmm datatype. -- diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 5c60b8a..de5bf0a 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -2,7 +2,7 @@ -- -- Pretty-printing of Cmm as C, suitable for feeding gcc -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -30,23 +30,21 @@ import MachOp import ForeignCall -- Utils -import DynFlags ( DynFlags, DynFlag(..), dopt ) -import Unique ( getUnique ) +import DynFlags +import Unique import UniqSet import FiniteMap -import UniqFM ( eltsUFM ) +import UniqFM import FastString import Outputable import Constants -import StaticFlags ( opt_Unregisterised ) -- The rest -import Data.List ( intersperse, groupBy ) -import Data.Bits ( shiftR ) -import Char ( ord, chr ) -import IO ( Handle ) -import DATA_BITS -import Data.Word ( Word8 ) +import Data.List +import Data.Bits +import Data.Char +import System.IO +import Data.Word #ifdef DEBUG import PprCmm () -- instances only @@ -56,7 +54,7 @@ import PprCmm () -- instances only #if __GLASGOW_HASKELL__ >= 504 import Data.Array.ST #endif -import MONAD_ST +import Control.Monad.ST -- -------------------------------------------------------------------------- -- Top level diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 6e8367d..6321410 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -2,7 +2,7 @@ -- -- Pretty-printing of Cmm as (a superset of) C-- -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -39,19 +39,19 @@ module PprCmm ( #include "HsVersions.h" import Cmm -import CmmUtils ( isTrivialCmmExpr ) -import MachOp ( MachOp(..), pprMachOp, MachRep(..), wordRep ) -import CLabel ( pprCLabel, mkForeignLabel, entryLblToInfoLbl ) +import CmmUtils +import MachOp +import CLabel -import ForeignCall ( CCallConv(..) ) -import Unique ( getUnique ) +import ForeignCall +import Unique import Outputable -import FastString ( mkFastString ) +import FastString -import Data.List ( intersperse, groupBy ) -import IO ( Handle ) -import Maybe ( isJust ) -import Data.Char ( chr ) +import Data.List +import System.IO +import Data.Maybe +import Data.Char pprCmms :: [Cmm] -> SDoc pprCmms cmms = pprCode CStyle (vcat (intersperse separator $ map ppr cmms)) diff --git a/compiler/codeGen/Bitmap.hs b/compiler/codeGen/Bitmap.hs index c0b4909..93cf43f 100644 --- a/compiler/codeGen/Bitmap.hs +++ b/compiler/codeGen/Bitmap.hs @@ -1,5 +1,5 @@ -- --- (c) The University of Glasgow 2003 +-- (c) The University of Glasgow 2003-2006 -- -- Functions for constructing bitmaps, which are used in various @@ -17,7 +17,8 @@ module Bitmap ( import SMRep import Constants -import DATA_BITS + +import Data.Bits {-| A bitmap represented by a sequence of 'StgWord's on the /target/ diff --git a/compiler/codeGen/CgBindery.lhs b/compiler/codeGen/CgBindery.lhs index 96735ef..d7f2579 100644 --- a/compiler/codeGen/CgBindery.lhs +++ b/compiler/codeGen/CgBindery.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[CgBindery]{Utility functions related to doing @CgBindings@} @@ -31,26 +32,24 @@ module CgBindery ( #include "HsVersions.h" import CgMonad -import CgHeapery ( getHpRelOffset ) -import CgStackery ( freeStackSlots, getSpRelOffset ) -import CgUtils ( cgLit, cmmOffsetW ) -import CLabel ( mkClosureLabel, pprCLabel ) -import ClosureInfo ( mkLFImported, mkLFArgument, LambdaFormInfo ) +import CgHeapery +import CgStackery +import CgUtils +import CLabel +import ClosureInfo import Cmm import PprCmm ( {- instance Outputable -} ) -import SMRep ( CgRep(..), WordOff, isFollowableArg, - isVoidArg, cgRepSizeW, argMachRep, - idCgRep, typeCgRep ) -import Id ( Id, idName ) +import SMRep +import Id import VarEnv -import VarSet ( varSetElems ) -import Literal ( literalType ) -import Maybes ( catMaybes ) -import Name ( isExternalName ) -import StgSyn ( StgArg, StgLiveVars, GenStgArg(..), isStgTypeArg ) -import Unique ( Uniquable(..) ) -import UniqSet ( elementOfUniqSet ) +import VarSet +import Literal +import Maybes +import Name +import StgSyn +import Unique +import UniqSet import Outputable \end{code} diff --git a/compiler/codeGen/CgCallConv.hs b/compiler/codeGen/CgCallConv.hs index f463255..b48b7d5 100644 --- a/compiler/codeGen/CgCallConv.hs +++ b/compiler/codeGen/CgCallConv.hs @@ -1,12 +1,12 @@ ----------------------------------------------------------------------------- -- --- CgCallConv +-- (c) The University of Glasgow 2004-2006 +-- +-- CgCallConv -- -- The datatypes and functions here encapsulate the -- calling and return conventions used by the code generator. -- --- (c) The University of Glasgow 2004 --- ----------------------------------------------------------------------------- @@ -33,36 +33,29 @@ module CgCallConv ( #include "HsVersions.h" -import CgUtils ( emitRODataLits, mkWordCLit ) +import CgUtils import CgMonad - -import Constants ( mAX_FAMILY_SIZE_FOR_VEC_RETURNS, - mAX_Vanilla_REG, mAX_Float_REG, - mAX_Double_REG, mAX_Long_REG, - mAX_Real_Vanilla_REG, mAX_Real_Float_REG, - mAX_Real_Double_REG, mAX_Real_Long_REG, - bITMAP_BITS_SHIFT - ) - -import ClosureInfo ( ArgDescr(..), Liveness(..) ) -import CgStackery ( getSpRelOffset ) import SMRep -import MachOp ( wordRep ) -import Cmm ( CmmExpr(..), GlobalReg(..), CmmLit(..), CmmReg(..), node ) -import CmmUtils ( mkLblExpr ) + +import MachOp +import Cmm import CLabel -import Maybes ( mapCatMaybes ) -import Id ( Id ) -import Name ( Name ) -import TyCon ( TyCon, tyConFamilySize ) -import Bitmap ( Bitmap, mAX_SMALL_BITMAP_SIZE, - mkBitmap, intsToReverseBitmap ) -import Util ( isn'tIn, sortLe ) -import StaticFlags ( opt_Unregisterised ) -import FastString ( LitString ) + +import Constants +import ClosureInfo +import CgStackery +import CmmUtils +import Maybes +import Id +import Name +import TyCon +import Bitmap +import Util +import StaticFlags +import FastString import Outputable -import DATA_BITS +import Data.Bits ------------------------------------------------------------------------- -- diff --git a/compiler/codeGen/CgCase.lhs b/compiler/codeGen/CgCase.lhs index 7b4861a..23310dd 100644 --- a/compiler/codeGen/CgCase.lhs +++ b/compiler/codeGen/CgCase.lhs @@ -1,13 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgCase.lhs,v 1.75 2005/06/21 10:44:41 simonmar Exp $ -% -%******************************************************** -%* * -\section[CgCase]{Converting @StgCase@ expressions} -%* * -%******************************************************** \begin{code} module CgCase ( cgCase, saveVolatileVarsAndRegs, @@ -19,43 +13,33 @@ module CgCase ( cgCase, saveVolatileVarsAndRegs, import {-# SOURCE #-} CgExpr ( cgExpr ) import CgMonad -import StgSyn -import CgBindery ( getArgAmodes, - bindNewToReg, bindNewToTemp, - getCgIdInfo, getArgAmode, - rebindToStack, getCAddrModeIfVolatile, - nukeDeadBindings, idInfoToAmode - ) -import CgCon ( bindConArgs, bindUnboxedTupleComponents ) -import CgHeapery ( altHeapCheck, unbxTupleHeapCheck ) -import CgCallConv ( dataReturnConvPrim, ctrlReturnConvAlg, - CtrlReturnConvention(..) - ) -import CgStackery ( allocPrimStack, allocStackTop, getSpRelOffset, - deAllocStackTop, freeStackSlots - ) -import CgTailCall ( performTailCall ) -import CgPrimOp ( cgPrimOp ) -import CgForeignCall ( cgForeignCall ) -import CgUtils ( newTemp, cgLit, emitLitSwitch, emitSwitch, - tagToClosure ) -import CgProf ( curCCS, curCCSAddr ) -import CgInfoTbls ( emitDirectReturnTarget, emitAlgReturnTarget, - dataConTagZ ) -import SMRep ( CgRep(..), retAddrSizeW, nonVoidArg, isVoidArg, - idCgRep, tyConCgRep, typeHint ) -import CmmUtils ( CmmStmts, noStmts, oneStmt, plusStmts ) +import CgBindery +import CgCon +import CgHeapery +import CgCallConv +import CgStackery +import CgTailCall +import CgPrimOp +import CgForeignCall +import CgUtils +import CgProf +import CgInfoTbls + +import ClosureInfo +import SMRep +import CmmUtils import Cmm -import MachOp ( wordRep ) -import ClosureInfo ( mkLFArgument ) -import StaticFlags ( opt_SccProfilingOn ) -import Id ( Id, idName, isDeadBinder, idType ) -import ForeignCall ( ForeignCall(..), CCallSpec(..), playSafe ) -import VarSet ( varSetElems ) -import CoreSyn ( AltCon(..) ) -import PrimOp ( PrimOp(..), primOpOutOfLine ) -import TyCon ( isEnumerationTyCon, tyConFamilySize ) -import Util ( isSingleton ) +import MachOp + +import StgSyn +import StaticFlags +import Id +import ForeignCall +import VarSet +import CoreSyn +import PrimOp +import TyCon +import Util import Outputable \end{code} diff --git a/compiler/codeGen/CgClosure.lhs b/compiler/codeGen/CgClosure.lhs index 1a2cbc5..99290d2 100644 --- a/compiler/codeGen/CgClosure.lhs +++ b/compiler/codeGen/CgClosure.lhs @@ -1,8 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgClosure.lhs,v 1.72 2005/05/18 12:06:51 simonmar Exp $ -% \section[CgClosure]{Code generation for closures} This module provides the support code for @StgToAbstractC@ to deal @@ -23,34 +22,29 @@ import {-# SOURCE #-} CgExpr ( cgExpr ) import CgMonad import CgBindery import CgHeapery -import CgStackery ( mkVirtStkOffsets, pushUpdateFrame, getVirtSp, - setRealAndVirtualSp ) -import CgProf ( chooseDynCostCentres, ldvEnter, enterCostCentre, - costCentreFrom ) +import CgStackery +import CgProf import CgTicky -import CgParallel ( granYield, granFetchAndReschedule ) -import CgInfoTbls ( emitClosureCodeAndInfoTable, getSRTInfo ) -import CgCallConv ( assignCallRegs, mkArgDescr ) -import CgUtils ( emitDataLits, addIdReps, cmmRegOffW, - emitRtsCallWithVols ) -import ClosureInfo -- lots and lots of stuff -import SMRep ( CgRep, cgRepSizeW, argMachRep, fixedHdrSize, WordOff, - idCgRep ) -import MachOp ( MachHint(..) ) +import CgParallel +import CgInfoTbls +import CgCallConv +import CgUtils +import ClosureInfo +import SMRep +import MachOp import Cmm -import CmmUtils ( CmmStmts, mkStmts, oneStmt, plusStmts, noStmts, - mkLblExpr ) +import CmmUtils import CLabel import StgSyn -import StaticFlags ( opt_DoTickyProfiling ) +import StaticFlags import CostCentre -import Id ( Id, idName, idType ) -import Name ( Name, isExternalName ) -import Module ( Module, pprModule ) -import ListSetOps ( minusList ) -import Util ( isIn, mapAccumL, zipWithEqual ) -import BasicTypes ( TopLevelFlag(..) ) -import Constants ( oFFSET_StgInd_indirectee, wORD_SIZE ) +import Id +import Name +import Module +import ListSetOps +import Util +import BasicTypes +import Constants import Outputable import FastString \end{code} @@ -79,7 +73,7 @@ cgTopRhsClosure id ccs binder_info srt upd_flag args body = do let name = idName id ; lf_info <- mkClosureLFInfo id TopLevel [] upd_flag args ; srt_info <- getSRTInfo name srt - ; mod_name <- moduleName + ; mod_name <- getModuleName ; let descr = closureDescription mod_name name closure_info = mkClosureInfo True id lf_info 0 0 srt_info descr closure_label = mkLocalClosureLabel name @@ -118,7 +112,7 @@ cgStdRhsClosure bndr cc bndr_info fvs args body lf_info payload = do -- AHA! A STANDARD-FORM THUNK { -- LAY OUT THE OBJECT amodes <- getArgAmodes payload - ; mod_name <- moduleName + ; mod_name <- getModuleName ; let (tot_wds, ptr_wds, amodes_w_offsets) = mkVirtHeapOffsets (isLFThunk lf_info) amodes @@ -169,7 +163,7 @@ cgRhsClosure bndr cc bndr_info srt fvs upd_flag args body = do ; lf_info <- mkClosureLFInfo bndr NotTopLevel fvs upd_flag args ; fv_infos <- mapFCs getCgIdInfo reduced_fvs ; srt_info <- getSRTInfo name srt - ; mod_name <- moduleName + ; mod_name <- getModuleName ; let bind_details :: [(CgIdInfo, VirtualHpOffset)] (tot_wds, ptr_wds, bind_details) = mkVirtHeapOffsets (isLFThunk lf_info) (map add_rep fv_infos) diff --git a/compiler/codeGen/CgCon.lhs b/compiler/codeGen/CgCon.lhs index 115439a..6e85c2c 100644 --- a/compiler/codeGen/CgCon.lhs +++ b/compiler/codeGen/CgCon.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP Project, Glasgow University, 1992-1998 % \section[CgCon]{Code generation for constructors} @@ -20,40 +21,30 @@ module CgCon ( import CgMonad import StgSyn -import CgBindery ( getArgAmodes, bindNewToNode, - bindArgsToRegs, idInfoToAmode, stableIdInfo, - heapIdInfo, CgIdInfo, bindArgsToStack - ) -import CgStackery ( mkVirtStkOffsets, freeStackSlots, - getRealSp, getVirtSp, setRealAndVirtualSp ) -import CgUtils ( addIdReps, cmmLabelOffW, emitRODataLits, emitDataLits ) -import CgCallConv ( assignReturnRegs ) -import CgHeapery ( allocDynClosure, layOutDynConstr, - layOutStaticConstr, mkStaticClosureFields ) -import CgTailCall ( performReturn, emitKnownConReturnCode, returnUnboxedTuple ) -import CgProf ( mkCCostCentreStack, ldvEnter, curCCS ) +import CgBindery +import CgStackery +import CgUtils +import CgCallConv +import CgHeapery +import CgTailCall +import CgProf import CgTicky -import CgInfoTbls ( emitClosureCodeAndInfoTable, dataConTagZ ) +import CgInfoTbls import CLabel -import ClosureInfo ( mkConLFInfo, mkLFArgument ) -import CmmUtils ( mkLblExpr ) +import ClosureInfo +import CmmUtils import Cmm -import SMRep ( WordOff, CgRep, separateByPtrFollowness, - fixedHdrSize, typeCgRep ) -import CostCentre ( currentOrSubsumedCCS, dontCareCCS, CostCentreStack, - currentCCS ) -import Constants ( mIN_INTLIKE, mAX_INTLIKE, mIN_CHARLIKE, mAX_CHARLIKE ) -import TyCon ( TyCon, tyConDataCons, isEnumerationTyCon, tyConName ) -import DataCon ( DataCon, dataConRepArgTys, isNullaryRepDataCon, - isUnboxedTupleCon, dataConWorkId, - dataConName, dataConRepArity - ) -import Id ( Id, idName, isDeadBinder ) -import Type ( Type ) -import PrelInfo ( maybeCharLikeCon, maybeIntLikeCon ) +import SMRep +import CostCentre +import Constants +import TyCon +import DataCon +import Id +import Type +import PrelInfo import Outputable -import Util ( lengthIs ) -import ListSetOps ( assocMaybe ) +import Util +import ListSetOps \end{code} diff --git a/compiler/codeGen/CgExpr.lhs b/compiler/codeGen/CgExpr.lhs index 551a40b..fff2b3d 100644 --- a/compiler/codeGen/CgExpr.lhs +++ b/compiler/codeGen/CgExpr.lhs @@ -1,56 +1,45 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgExpr.lhs,v 1.62 2005/06/21 10:44:41 simonmar Exp $ -% -%******************************************************** -%* * -\section[CgExpr]{Converting @StgExpr@s} -%* * -%******************************************************** \begin{code} module CgExpr ( cgExpr ) where #include "HsVersions.h" -import Constants ( mAX_SPEC_SELECTEE_SIZE, mAX_SPEC_AP_SIZE ) +import Constants import StgSyn import CgMonad -import SMRep ( fixedHdrSize, isFollowableArg, CgRep(..), argMachRep, - nonVoidArg, idCgRep, typeCgRep, typeHint, - primRepToCgRep ) -import CoreSyn ( AltCon(..) ) -import CgProf ( emitSetCCC ) -import CgHeapery ( layOutDynConstr ) -import CgBindery ( getArgAmodes, getArgAmode, CgIdInfo, - nukeDeadBindings, addBindC, addBindsC ) -import CgCase ( cgCase, saveVolatileVarsAndRegs ) -import CgClosure ( cgRhsClosure, cgStdRhsClosure ) -import CgCon ( buildDynCon, cgReturnDataCon ) -import CgLetNoEscape ( cgLetNoEscapeClosure ) -import CgCallConv ( dataReturnConvPrim ) +import SMRep +import CoreSyn +import CgProf +import CgHeapery +import CgBindery +import CgCase +import CgClosure +import CgCon +import CgLetNoEscape +import CgCallConv import CgTailCall -import CgInfoTbls ( emitDirectReturnInstr ) -import CgForeignCall ( emitForeignCall, shimForeignCallArg ) -import CgPrimOp ( cgPrimOp ) -import CgUtils ( addIdReps, newTemp, assignTemp, cgLit, tagToClosure ) -import ClosureInfo ( mkSelectorLFInfo, mkApLFInfo ) -import Cmm ( CmmExpr(..), CmmStmt(..), CmmReg, nodeReg ) -import MachOp ( wordRep, MachHint ) +import CgInfoTbls +import CgForeignCall +import CgPrimOp +import CgUtils +import ClosureInfo +import Cmm +import MachOp import VarSet -import Literal ( literalType ) -import PrimOp ( primOpOutOfLine, getPrimOpResultInfo, - PrimOp(..), PrimOpResultInfo(..) ) -import Id ( Id ) -import TyCon ( isUnboxedTupleTyCon, isEnumerationTyCon ) -import Type ( Type, tyConAppArgs, tyConAppTyCon, repType, - PrimRep(VoidRep) ) -import Maybes ( maybeToBool ) -import ListSetOps ( assocMaybe ) -import BasicTypes ( RecFlag(..) ) -import Util ( lengthIs ) +import Literal +import PrimOp +import Id +import TyCon +import Type +import Maybes +import ListSetOps +import BasicTypes +import Util import Outputable \end{code} diff --git a/compiler/codeGen/CgForeignCall.hs b/compiler/codeGen/CgForeignCall.hs index 822a043..da52bd0 100644 --- a/compiler/codeGen/CgForeignCall.hs +++ b/compiler/codeGen/CgForeignCall.hs @@ -2,7 +2,7 @@ -- -- Code generation for foreign calls. -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -19,24 +19,24 @@ module CgForeignCall ( #include "HsVersions.h" -import StgSyn ( StgLiveVars, StgArg, stgArgType ) -import CgProf ( curCCS, curCCSAddr ) -import CgBindery ( getVolatileRegs, getArgAmodes ) +import StgSyn +import CgProf +import CgBindery import CgMonad -import CgUtils ( cmmOffsetW, cmmOffsetB, newTemp ) -import Type ( tyConAppTyCon, repType ) +import CgUtils +import Type import TysPrim -import CLabel ( mkForeignLabel, mkRtsCodeLabel ) +import CLabel import Cmm import CmmUtils import MachOp import SMRep import ForeignCall import Constants -import StaticFlags ( opt_SccProfilingOn ) +import StaticFlags import Outputable -import Monad ( when ) +import Control.Monad -- ----------------------------------------------------------------------------- -- Code generation for Foreign Calls diff --git a/compiler/codeGen/CgHeapery.lhs b/compiler/codeGen/CgHeapery.lhs index ae6c892..4a12849 100644 --- a/compiler/codeGen/CgHeapery.lhs +++ b/compiler/codeGen/CgHeapery.lhs @@ -1,8 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgHeapery.lhs,v 1.47 2005/06/21 10:44:41 simonmar Exp $ -% \section[CgHeapery]{Heap management functions} \begin{code} @@ -23,39 +22,29 @@ module CgHeapery ( #include "HsVersions.h" -import StgSyn ( AltType(..) ) -import CLabel ( CLabel, mkRtsCodeLabel ) -import CgUtils ( mkWordCLit, cmmRegOffW, cmmOffsetW, - cmmOffsetExprB ) +import StgSyn +import CLabel +import CgUtils import CgMonad -import CgProf ( staticProfHdr, profDynAlloc, dynProfHdr ) -import CgTicky ( staticTickyHdr, tickyDynAlloc, tickyAllocHeap ) -import CgParallel ( staticGranHdr, staticParHdr, doGranAllocate ) -import CgStackery ( getFinalStackHW, getRealSp ) -import CgCallConv ( mkRegLiveness ) -import ClosureInfo ( closureSize, staticClosureNeedsLink, - mkConInfo, closureNeedsUpdSpace, - infoTableLabelFromCI, closureLabelFromCI, - nodeMustPointToIt, closureLFInfo, - ClosureInfo ) -import SMRep ( CgRep(..), cgRepSizeW, separateByPtrFollowness, - WordOff, fixedHdrSize, thunkHdrSize, - isVoidArg, primRepToCgRep ) - -import Cmm ( CmmLit(..), CmmStmt(..), CmmExpr(..), GlobalReg(..), - CmmReg(..), hpReg, nodeReg, spReg ) -import MachOp ( mo_wordULt, mo_wordUGt, mo_wordSub ) -import CmmUtils ( mkIntCLit, CmmStmts, noStmts, oneStmt, plusStmts, - mkStmts ) -import Id ( Id ) -import DataCon ( DataCon ) -import TyCon ( tyConPrimRep ) -import CostCentre ( CostCentreStack ) -import Util ( mapAccumL, filterOut ) -import Constants ( wORD_SIZE ) -import PackageConfig ( PackageId ) +import CgProf +import CgTicky +import CgParallel +import CgStackery +import CgCallConv +import ClosureInfo +import SMRep + +import Cmm +import MachOp +import CmmUtils +import Id +import DataCon +import TyCon +import CostCentre +import Util +import Constants +import PackageConfig import Outputable - \end{code} diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs index 5a40a3d..f233cbb 100644 --- a/compiler/codeGen/CgInfoTbls.hs +++ b/compiler/codeGen/CgInfoTbls.hs @@ -2,7 +2,7 @@ -- -- Building info tables. -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -28,42 +28,27 @@ module CgInfoTbls ( #include "HsVersions.h" -import ClosureInfo ( ClosureInfo, closureTypeDescr, closureName, - infoTableLabelFromCI, Liveness, - closureValDescr, closureSRT, closureSMRep, - closurePtrsSize, closureNonHdrSize, closureFunInfo, - C_SRT(..), needsSRT, isConstrClosure_maybe, - ArgDescr(..) ) -import SMRep ( StgHalfWord, hALF_WORD_SIZE_IN_BITS, hALF_WORD_SIZE, - WordOff, ByteOff, - smRepClosureTypeInt, tablesNextToCode, - rET_BIG, rET_SMALL, rET_VEC_BIG, rET_VEC_SMALL ) -import CgBindery ( getLiveStackSlots ) -import CgCallConv ( isBigLiveness, mkLivenessCLit, buildContLiveness, - argDescrType, getSequelAmode, - CtrlReturnConvention(..) ) -import CgUtils ( mkStringCLit, packHalfWordsCLit, mkWordCLit, - cmmOffsetB, cmmOffsetExprW, cmmLabelOffW, cmmOffsetW, - emitDataLits, emitRODataLits, emitSwitch, cmmNegate, - newTemp ) +import ClosureInfo +import SMRep +import CgBindery +import CgCallConv +import CgUtils import CgMonad -import CmmUtils ( mkIntCLit, zeroCLit ) -import Cmm ( CmmStmt(..), CmmExpr(..), CmmLit(..), LocalReg, - CmmBasicBlock, nodeReg ) +import CmmUtils +import Cmm import MachOp import CLabel -import StgSyn ( SRT(..) ) -import Name ( Name ) -import DataCon ( DataCon, dataConTag, fIRST_TAG ) -import Unique ( Uniquable(..) ) -import DynFlags ( DynFlags(..), HscTarget(..) ) -import StaticFlags ( opt_SccProfilingOn ) -import ListSetOps ( assocDefault ) -import Maybes ( isJust ) -import Constants ( wORD_SIZE, sIZEOF_StgFunInfoExtraRev ) -import Outputable - +import StgSyn +import Name +import DataCon +import Unique +import DynFlags +import StaticFlags + +import ListSetOps +import Maybes +import Constants ------------------------------------------------------------------------- -- diff --git a/compiler/codeGen/CgLetNoEscape.lhs b/compiler/codeGen/CgLetNoEscape.lhs index ffec570..dd25f55 100644 --- a/compiler/codeGen/CgLetNoEscape.lhs +++ b/compiler/codeGen/CgLetNoEscape.lhs @@ -1,8 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % -% $Id: CgLetNoEscape.lhs,v 1.26 2004/09/30 10:35:47 simonpj Exp $ -% %******************************************************** %* * \section[CgLetNoEscape]{Handling ``let-no-escapes''} @@ -19,21 +18,21 @@ import {-# SOURCE #-} CgExpr ( cgExpr ) import StgSyn import CgMonad -import CgBindery ( CgIdInfo, letNoEscapeIdInfo, nukeDeadBindings ) -import CgCase ( restoreCurrentCostCentre ) -import CgCon ( bindUnboxedTupleComponents ) -import CgHeapery ( unbxTupleHeapCheck ) -import CgInfoTbls ( emitDirectReturnTarget ) -import CgStackery ( allocStackTop, deAllocStackTop, getSpRelOffset ) -import Cmm ( CmmStmt(..) ) -import CmmUtils ( mkLblExpr, oneStmt ) -import CLabel ( mkReturnInfoLabel ) -import ClosureInfo ( mkLFLetNoEscape ) -import CostCentre ( CostCentreStack ) -import Id ( Id, idName ) -import Var ( idUnique ) -import SMRep ( retAddrSizeW ) -import BasicTypes ( RecFlag(..) ) +import CgBindery +import CgCase +import CgCon +import CgHeapery +import CgInfoTbls +import CgStackery +import Cmm +import CmmUtils +import CLabel +import ClosureInfo +import CostCentre +import Id +import Var +import SMRep +import BasicTypes \end{code} %************************************************************************ diff --git a/compiler/codeGen/CgMonad.lhs b/compiler/codeGen/CgMonad.lhs index 1866df4..0757bbf 100644 --- a/compiler/codeGen/CgMonad.lhs +++ b/compiler/codeGen/CgMonad.lhs @@ -1,8 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgMonad.lhs,v 1.45 2005/06/21 10:44:41 simonmar Exp $ -% \section[CgMonad]{The code generation monad} See the beginning of the top-level @CodeGen@ module, to see how this @@ -42,7 +41,7 @@ module CgMonad ( getHpUsage, setHpUsage, heapHWM, - moduleName, + getModuleName, Sequel(..), -- ToDo: unabstract? @@ -61,23 +60,23 @@ module CgMonad ( import {-# SOURCE #-} CgBindery ( CgBindings, nukeVolatileBinds ) -import DynFlags ( DynFlags(..) ) -import PackageConfig ( PackageId ) +import DynFlags +import PackageConfig import Cmm -import CmmUtils ( CmmStmts, isNopStmt ) +import CmmUtils import CLabel -import SMRep ( WordOff ) -import Module ( Module ) -import Id ( Id ) +import SMRep +import Module +import Id import VarEnv import OrdList -import Unique ( Unique ) -import Util ( mapAccumL ) -import UniqSupply ( UniqSupply, mkSplitUniqSupply, splitUniqSupply, uniqFromSupply ) +import Unique +import Util +import UniqSupply import FastString import Outputable -import Control.Monad ( liftM ) +import Control.Monad infixr 9 `thenC` -- Right-associative! infixr 9 `thenFC` @@ -804,8 +803,8 @@ consCgStmt stmt stmts = CgStmt stmt `consOL` stmts -- ---------------------------------------------------------------------------- -- Get the current module name -moduleName :: FCode Module -moduleName = do { info <- getInfoDown; return (cgd_mod info) } +getModuleName :: FCode Module +getModuleName = do { info <- getInfoDown; return (cgd_mod info) } -- ---------------------------------------------------------------------------- -- Get/set the end-of-block info diff --git a/compiler/codeGen/CgParallel.hs b/compiler/codeGen/CgParallel.hs index b826a33..8cd5067 100644 --- a/compiler/codeGen/CgParallel.hs +++ b/compiler/codeGen/CgParallel.hs @@ -1,6 +1,12 @@ +----------------------------------------------------------------------------- +-- +-- (c) The University of Glasgow -2006 +-- -- Code generation relaed to GpH -- (a) parallel -- (b) GranSim +-- +----------------------------------------------------------------------------- module CgParallel( staticGranHdr,staticParHdr, @@ -9,10 +15,10 @@ module CgParallel( ) where import CgMonad -import CgCallConv ( mkRegLiveness ) -import Id ( Id ) -import Cmm ( CmmLit, GlobalReg(..), node, CmmExpr ) -import StaticFlags ( opt_GranMacros ) +import CgCallConv +import Id +import Cmm +import StaticFlags import Outputable staticParHdr :: [CmmLit] diff --git a/compiler/codeGen/CgPrimOp.hs b/compiler/codeGen/CgPrimOp.hs index bc7c914..3993f19 100644 --- a/compiler/codeGen/CgPrimOp.hs +++ b/compiler/codeGen/CgPrimOp.hs @@ -2,7 +2,7 @@ -- -- Code generation for PrimOps. -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -12,24 +12,23 @@ module CgPrimOp ( #include "HsVersions.h" -import ForeignCall ( CCallConv(CCallConv) ) -import StgSyn ( StgLiveVars, StgArg ) -import CgForeignCall ( emitForeignCall' ) -import CgBindery ( getVolatileRegs, getArgAmodes ) +import ForeignCall +import StgSyn +import CgForeignCall +import CgBindery import CgMonad -import CgInfoTbls ( getConstrTag ) -import CgUtils ( cmmOffsetW, cmmOffsetB, cmmLoadIndexW ) +import CgInfoTbls +import CgUtils import ForeignCall import Cmm -import CLabel ( mkMAP_FROZEN_infoLabel, mkMAP_DIRTY_infoLabel, - mkDirty_MUT_VAR_Label, mkRtsCodeLabel ) +import CLabel import CmmUtils import MachOp import SMRep -import PrimOp ( PrimOp(..) ) -import SMRep ( tablesNextToCode ) -import Constants ( wORD_SIZE, wORD_SIZE_IN_BITS ) -import StaticFlags ( opt_Parallel ) +import PrimOp +import SMRep +import Constants +import StaticFlags import Outputable -- --------------------------------------------------------------------------- diff --git a/compiler/codeGen/CgProf.hs b/compiler/codeGen/CgProf.hs index daff2f6..bc5473a 100644 --- a/compiler/codeGen/CgProf.hs +++ b/compiler/codeGen/CgProf.hs @@ -2,7 +2,7 @@ -- -- Code generation for profiling -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -32,30 +32,28 @@ module CgProf ( #include "../includes/DerivedConstants.h" -- For REP_xxx constants, which are MachReps -import ClosureInfo ( ClosureInfo, closureSize, - closureName, isToplevClosure, closureReEntrant, ) +import ClosureInfo import CgUtils import CgMonad -import SMRep ( StgWord, profHdrSize ) +import SMRep import Cmm import MachOp -import CmmUtils ( zeroCLit, mkIntCLit, mkLblExpr ) -import CLabel ( mkCCLabel, mkCCSLabel, mkRtsDataLabel ) +import CmmUtils +import CLabel -import Module ( moduleNameString ) -import qualified Module ( moduleName ) -- clashes with CgMonad.moduleName -import Id ( Id ) +import Id +import qualified Module import CostCentre -import StgSyn ( GenStgExpr(..), StgExpr ) -import StaticFlags ( opt_SccProfilingOn ) -import FastString ( FastString ) +import StgSyn +import StaticFlags +import FastString import Constants -- Lots of field offsets import Outputable -import Maybe -import Char ( ord ) -import Monad ( when ) +import Data.Maybe +import Data.Char +import Control.Monad ----------------------------------------------------------------------------- -- @@ -293,7 +291,8 @@ emitCostCentreDecl -> Code emitCostCentreDecl cc = do { label <- mkStringCLit (costCentreUserName cc) - ; modl <- mkStringCLit (moduleNameString (Module.moduleName (cc_mod cc))) + ; modl <- mkStringCLit (Module.moduleNameString + (Module.moduleName (cc_mod cc))) -- All cost centres will be in the main package, since we -- don't normally use -auto-all or add SCCs to other packages. -- Hence don't emit the package name in the module here. diff --git a/compiler/codeGen/CgStackery.lhs b/compiler/codeGen/CgStackery.lhs index 7cb310d..7a510cf 100644 --- a/compiler/codeGen/CgStackery.lhs +++ b/compiler/codeGen/CgStackery.lhs @@ -1,8 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgStackery.lhs,v 1.27 2004/09/30 10:35:49 simonpj Exp $ -% \section[CgStackery]{Stack management functions} Stack-twiddling operations, which are pretty low-down and grimy. @@ -24,16 +23,16 @@ module CgStackery ( #include "HsVersions.h" import CgMonad -import CgUtils ( cmmOffsetB, cmmRegOffW ) -import CgProf ( initUpdFrameProf ) +import CgUtils +import CgProf import SMRep import Cmm -import CmmUtils ( CmmStmts, mkLblExpr ) -import CLabel ( mkUpdInfoLabel ) +import CmmUtils +import CLabel import Constants -import Util ( sortLe ) -import FastString ( LitString ) -import OrdList ( toOL ) +import Util +import FastString +import OrdList import Outputable \end{code} diff --git a/compiler/codeGen/CgTailCall.lhs b/compiler/codeGen/CgTailCall.lhs index 56614a8..c65ec1c 100644 --- a/compiler/codeGen/CgTailCall.lhs +++ b/compiler/codeGen/CgTailCall.lhs @@ -1,13 +1,8 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgTailCall.lhs,v 1.43 2005/06/21 10:44:41 simonmar Exp $ -% -%******************************************************** -%* * -\section[CgTailCall]{Tail calls: converting @StgApps@} -%* * -%******************************************************** +% Code generation for tail calls. \begin{code} module CgTailCall ( @@ -24,31 +19,27 @@ module CgTailCall ( #include "HsVersions.h" import CgMonad -import CgBindery ( getArgAmodes, getCgIdInfo, CgIdInfo, maybeLetNoEscape, - idInfoToAmode, cgIdInfoId, cgIdInfoLF, - cgIdInfoArgRep ) -import CgInfoTbls ( entryCode, emitDirectReturnInstr, dataConTagZ, - emitVectoredReturnInstr, closureInfoPtr ) +import CgBindery +import CgInfoTbls import CgCallConv -import CgStackery ( setRealSp, mkStkAmodes, adjustStackHW, - getSpRelOffset ) -import CgHeapery ( setRealHp, getHpRelOffset ) -import CgUtils ( emitSimultaneously ) +import CgStackery +import CgHeapery +import CgUtils import CgTicky import ClosureInfo -import SMRep ( CgRep, isVoidArg, separateByPtrFollowness ) +import SMRep import Cmm import CmmUtils -import CLabel ( CLabel, mkRtsPrimOpLabel, mkSeqInfoLabel ) -import Type ( isUnLiftedType ) -import Id ( Id, idName, idUnique, idType ) -import DataCon ( DataCon, dataConTyCon ) -import StgSyn ( StgArg ) -import TyCon ( TyCon ) -import PrimOp ( PrimOp ) +import CLabel +import Type +import Id +import DataCon +import StgSyn +import TyCon +import PrimOp import Outputable -import Monad ( when ) +import Control.Monad ----------------------------------------------------------------------------- -- Tail Calls diff --git a/compiler/codeGen/CgTicky.hs b/compiler/codeGen/CgTicky.hs index 3e72981..985ebb8 100644 --- a/compiler/codeGen/CgTicky.hs +++ b/compiler/codeGen/CgTicky.hs @@ -2,7 +2,7 @@ -- -- Code generation for ticky-ticky profiling -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -40,32 +40,30 @@ module CgTicky ( #include "../includes/DerivedConstants.h" -- For REP_xxx constants, which are MachReps -import ClosureInfo ( ClosureInfo, closureSize, slopSize, closureSMRep, - closureUpdReqd, closureName, isStaticClosure ) +import ClosureInfo import CgUtils import CgMonad -import SMRep ( ClosureType(..), smRepClosureType, CgRep ) +import SMRep import Cmm import MachOp -import CmmUtils ( zeroCLit, mkIntCLit, mkLblExpr, cmmIndexExpr ) -import CLabel ( CLabel, mkRtsDataLabel, mkRednCountsLabel ) - -import Name ( isInternalName ) -import Id ( Id, idType ) -import StaticFlags ( opt_DoTickyProfiling ) -import BasicTypes ( Arity ) -import FastString ( FastString, mkFastString, LitString ) -import Constants -- Lots of field offsets +import CmmUtils +import CLabel + +import Name +import Id +import StaticFlags +import BasicTypes +import FastString +import Constants import Outputable -- Turgid imports for showTypeCategory import PrelNames -import TcType ( Type, isDictTy, tcSplitTyConApp_maybe, - tcSplitFunTy_maybe ) -import TyCon ( isPrimTyCon, isTupleTyCon, isEnumerationTyCon, - maybeTyConSingleCon ) -import Maybe +import TcType +import TyCon + +import Data.Maybe ----------------------------------------------------------------------------- -- @@ -83,7 +81,7 @@ staticTickyHdr emitTickyCounter :: ClosureInfo -> [Id] -> Int -> Code emitTickyCounter cl_info args on_stk = ifTicky $ - do { mod_name <- moduleName + do { mod_name <- getModuleName ; fun_descr_lit <- mkStringCLit (fun_descr mod_name) ; arg_descr_lit <- mkStringCLit arg_descr ; emitDataLits ticky_ctr_label -- Must match layout of StgEntCounter diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs index 21e6d08..ab39080 100644 --- a/compiler/codeGen/CgUtils.hs +++ b/compiler/codeGen/CgUtils.hs @@ -2,7 +2,7 @@ -- -- Code generator utilities; mostly monadic -- --- (c) The University of Glasgow 2004 +-- (c) The University of Glasgow 2004-2006 -- ----------------------------------------------------------------------------- @@ -34,32 +34,29 @@ module CgUtils ( #include "HsVersions.h" import CgMonad -import TyCon ( TyCon, tyConName ) -import Id ( Id ) -import Constants ( wORD_SIZE ) -import SMRep ( CgRep, StgWord, hALF_WORD_SIZE_IN_BITS, ByteOff, - WordOff, idCgRep ) +import TyCon +import Id +import Constants +import SMRep import PprCmm ( {- instances -} ) import Cmm import CLabel import CmmUtils -import MachOp ( MachRep(..), wordRep, MachOp(..), MachHint(..), - mo_wordOr, mo_wordAnd, mo_wordNe, mo_wordEq, - mo_wordULt, mo_wordUGt, mo_wordUGe, machRepByteWidth ) -import ForeignCall ( CCallConv(..) ) -import Literal ( Literal(..) ) -import Digraph ( SCC(..), stronglyConnComp ) -import ListSetOps ( assocDefault ) -import Util ( filterOut, sortLe ) -import DynFlags ( DynFlags(..), HscTarget(..) ) -import FastString ( LitString, bytesFS ) -import PackageConfig ( PackageId ) +import MachOp +import ForeignCall +import Literal +import Digraph +import ListSetOps +import Util +import DynFlags +import FastString +import PackageConfig import Outputable -import Char ( ord ) -import DATA_BITS -import DATA_WORD ( Word8 ) -import Maybe ( isNothing ) +import Data.Char +import Data.Bits +import Data.Word +import Data.Maybe ------------------------------------------------------------------------- -- diff --git a/compiler/codeGen/ClosureInfo.lhs b/compiler/codeGen/ClosureInfo.lhs index d137d4d..831e4ec 100644 --- a/compiler/codeGen/ClosureInfo.lhs +++ b/compiler/codeGen/ClosureInfo.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The Univserity of Glasgow 1992-2004 % @@ -57,27 +58,25 @@ module ClosureInfo ( #include "HsVersions.h" import StgSyn -import SMRep -- all of it +import SMRep import CLabel -import Packages ( isDllName ) -import PackageConfig ( PackageId ) -import StaticFlags ( opt_SccProfilingOn, opt_OmitBlackHoling, - opt_Parallel, opt_DoTickyProfiling ) -import Id ( Id, idType, idArity, idName ) -import DataCon ( DataCon, dataConTyCon, isNullaryRepDataCon, dataConName ) -import Name ( Name, nameUnique, getOccName, getOccString ) -import OccName ( occNameString ) -import Type ( isUnLiftedType, Type, repType, splitTyConApp_maybe ) -import TcType ( tcSplitSigmaTy ) -import TyCon ( isFunTyCon, isAbstractTyCon ) -import BasicTypes ( TopLevelFlag(..), isNotTopLevel, isTopLevel, ipNameName ) +import Packages +import PackageConfig +import StaticFlags +import Id +import DataCon +import Name +import OccName +import Type +import TypeRep +import TcType +import TyCon +import BasicTypes import FastString import Outputable import Constants - -import TypeRep -- TEMP \end{code} diff --git a/compiler/codeGen/CodeGen.lhs b/compiler/codeGen/CodeGen.lhs index 4c08242..2c4ea5c 100644 --- a/compiler/codeGen/CodeGen.lhs +++ b/compiler/codeGen/CodeGen.lhs @@ -1,19 +1,15 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[CodeGen]{@CodeGen@: main module of the code generator} + +The Code Generator This module says how things get going at the top level. @codeGen@ is the interface to the outside world. The \tr{cgTop*} functions drive the mangling of top-level bindings. -%************************************************************************ -%* * -\subsection[codeGen-outside-interface]{The code generator's offering to the world} -%* * -%************************************************************************ - \begin{code} module CodeGen ( codeGen ) where @@ -25,35 +21,34 @@ module CodeGen ( codeGen ) where import CgExpr ( {-NOTHING!-} ) -- DO NOT DELETE THIS IMPORT import CgProf import CgMonad -import CgBindery ( CgIdInfo, addBindC, addBindsC, getCgIdInfo, - cgIdInfoId ) -import CgClosure ( cgTopRhsClosure ) -import CgCon ( cgTopRhsCon, cgTyCon ) -import CgUtils ( cmmRegOffW, emitRODataLits, cmmNeWord ) +import CgBindery +import CgClosure +import CgCon +import CgUtils import CLabel import Cmm -import CmmUtils ( zeroCLit, mkIntCLit, mkLblExpr ) -import PprCmm ( pprCmms ) -import MachOp ( wordRep ) +import CmmUtils +import PprCmm +import MachOp import StgSyn -import PrelNames ( gHC_PRIM, rOOT_MAIN, gHC_TOP_HANDLER ) -import DynFlags ( DynFlags(..), DynFlag(..), dopt ) -import StaticFlags ( opt_SccProfilingOn ) - -import PackageConfig ( PackageId ) -import HscTypes ( ForeignStubs(..) ) -import CostCentre ( CollectedCCs ) -import Id ( Id, idName, setIdName ) -import Name ( nameSrcLoc, nameOccName, nameUnique, isInternalName, mkExternalName ) -import OccName ( mkLocalOcc ) -import TyCon ( TyCon ) -import Module ( Module ) -import ErrUtils ( dumpIfSet_dyn, showPass ) +import PrelNames +import DynFlags +import StaticFlags + +import PackageConfig +import HscTypes +import CostCentre +import Id +import Name +import OccName +import TyCon +import Module +import ErrUtils #ifdef DEBUG -import Panic ( assertPanic ) +import Panic #endif \end{code} @@ -326,7 +321,7 @@ which refers to this name). maybeExternaliseId :: DynFlags -> Id -> FCode Id maybeExternaliseId dflags id | dopt Opt_SplitObjs dflags, -- Externalise the name for -split-objs - isInternalName name = do { mod <- moduleName + isInternalName name = do { mod <- getModuleName ; returnFC (setIdName id (externalise mod)) } | otherwise = returnFC id where diff --git a/compiler/codeGen/SMRep.lhs b/compiler/codeGen/SMRep.lhs index 521b626..2419ba1 100644 --- a/compiler/codeGen/SMRep.lhs +++ b/compiler/codeGen/SMRep.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[SMRep]{Storage manager representations of closure} + +Storage manager representation of closures This is here, rather than in ClosureInfo, just to keep nhc happy. Other modules should access this info through ClosureInfo. @@ -38,16 +40,15 @@ module SMRep ( #include "HsVersions.h" #include "../includes/MachDeps.h" -import Id ( Id, idType ) -import Type ( Type, typePrimRep, PrimRep(..) ) -import TyCon ( TyCon, tyConPrimRep ) -import MachOp-- ( MachRep(..), MachHint(..), wordRep ) -import StaticFlags ( opt_SccProfilingOn, opt_GranMacros, - opt_Unregisterised ) +import Id +import Type +import TyCon +import MachOp +import StaticFlags import Constants import Outputable -import DATA_WORD +import Data.Word \end{code} diff --git a/compiler/coreSyn/CoreFVs.lhs b/compiler/coreSyn/CoreFVs.lhs index 22f7dc8..c32ca7c 100644 --- a/compiler/coreSyn/CoreFVs.lhs +++ b/compiler/coreSyn/CoreFVs.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % Taken quite directly from the Peyton Jones/Lester paper. @@ -25,16 +26,15 @@ module CoreFVs ( #include "HsVersions.h" import CoreSyn -import Id ( Id, idType, idSpecialisation, isLocalId ) -import IdInfo ( specInfoFreeVars ) +import Id +import IdInfo import NameSet -import UniqFM ( delFromUFM ) -import Name ( isExternalName ) +import UniqFM +import Name import VarSet -import Var ( Var, isId, isLocalVar, varName ) -import Type ( tyVarsOfType ) -import TcType ( tyClsNamesOfType ) -import Util ( mapAndUnzip ) +import Var +import TcType +import Util import Outputable \end{code} @@ -213,11 +213,11 @@ exprFreeNames e go (Var v) | isExternalName n = unitNameSet n | otherwise = emptyNameSet - where n = varName v + where n = idName v go (Lit _) = emptyNameSet go (Type ty) = tyClsNamesOfType ty -- Don't need free tyvars go (App e1 e2) = go e1 `unionNameSets` go e2 - go (Lam v e) = go e `delFromNameSet` varName v + go (Lam v e) = go e `delFromNameSet` idName v go (Note n e) = go e go (Cast e co) = go e `unionNameSets` tyClsNamesOfType co go (Let (NonRec b r) e) = go e `unionNameSets` go r diff --git a/compiler/coreSyn/CoreLint.lhs b/compiler/coreSyn/CoreLint.lhs index 406bf90..a33c469 100644 --- a/compiler/coreSyn/CoreLint.lhs +++ b/compiler/coreSyn/CoreLint.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % -\section[CoreLint]{A ``lint'' pass to check for Core correctness} + +A ``lint'' pass to check for Core correctness \begin{code} module CoreLint ( @@ -13,43 +15,32 @@ module CoreLint ( #include "HsVersions.h" import CoreSyn -import CoreFVs ( idFreeVars ) -import CoreUtils ( findDefault, exprOkForSpeculation, coreBindsSize ) +import CoreFVs +import CoreUtils import Bag -import Literal ( literalType ) -import DataCon ( dataConRepType, dataConTyCon, dataConWorkId ) -import TysWiredIn ( tupleCon ) -import Var ( Var, Id, TyVar, isCoVar, idType, tyVarKind, - mustHaveLocalBinding, setTyVarKind, setIdType ) -import VarEnv ( lookupInScope ) +import Literal +import DataCon +import TysWiredIn +import Var +import VarEnv import VarSet -import Name ( getSrcLoc ) +import Name import PprCore -import ErrUtils ( dumpIfSet_core, ghcExit, Message, showPass, - mkLocMessage, debugTraceMsg ) -import SrcLoc ( SrcLoc, noSrcLoc, mkSrcSpan ) -import Type ( Type, tyVarsOfType, coreEqType, - splitFunTy_maybe, - splitForAllTy_maybe, splitTyConApp_maybe, - isUnLiftedType, typeKind, mkForAllTy, mkFunTy, - isUnboxedTupleType, isSubKind, - substTyWith, emptyTvSubst, extendTvInScope, - TvSubst, substTy, - extendTvSubst, substTyVarBndr, isInScope, - getTvInScope ) -import Coercion ( coercionKind, coercionKindPredTy ) -import TyCon ( isPrimTyCon, isNewTyCon ) -import BasicTypes ( RecFlag(..), Boxity(..), isNonRec ) -import StaticFlags ( opt_PprStyle_Debug ) -import DynFlags ( DynFlags, DynFlag(..), dopt ) +import ErrUtils +import SrcLoc +import Type +import Coercion +import TyCon +import BasicTypes +import StaticFlags +import DynFlags import Outputable #ifdef DEBUG import Util ( notNull ) #endif -import Maybe - +import Data.Maybe \end{code} %************************************************************************ diff --git a/compiler/coreSyn/CorePrep.lhs b/compiler/coreSyn/CorePrep.lhs index c8f35ea..3b8f577 100644 --- a/compiler/coreSyn/CorePrep.lhs +++ b/compiler/coreSyn/CorePrep.lhs @@ -1,7 +1,8 @@ % -% (c) The University of Glasgow, 1994-2000 +% (c) The University of Glasgow, 1994-2006 % -\section{Core pass to saturate constructors and PrimOps} + +Core pass to saturate constructors and PrimOps \begin{code} module CorePrep ( @@ -10,33 +11,27 @@ module CorePrep ( #include "HsVersions.h" -import CoreUtils( exprType, exprIsHNF, etaExpand, exprArity, exprOkForSpeculation ) -import CoreFVs ( exprFreeVars ) -import CoreLint ( endPass ) +import CoreUtils hiding (exprIsTrivial) +import CoreFVs +import CoreLint import CoreSyn -import Type ( Type, applyTy, - splitFunTy_maybe, isUnLiftedType, isUnboxedTupleType, seqType ) -import Coercion ( coercionKind ) -import TyCon ( TyCon, tyConDataCons ) -import NewDemand ( Demand, isStrictDmd, lazyDmd, StrictSig(..), DmdType(..) ) -import Var ( Var, Id, setVarUnique ) +import Type +import Coercion +import TyCon +import NewDemand +import Var import VarSet import VarEnv -import Id ( mkSysLocal, idType, idNewDemandInfo, idArity, setIdUnfolding, - isFCallId, isGlobalId, isLocalId, hasNoBinding, idNewStrictness, - isPrimOpId_maybe - ) -import DataCon ( dataConWorkId ) -import PrimOp ( PrimOp( DataToTagOp ) ) -import BasicTypes ( TopLevelFlag(..), isTopLevel, isNotTopLevel, - RecFlag(..), isNonRec - ) +import Id +import DataCon +import PrimOp +import BasicTypes import UniqSupply import Maybes import OrdList import ErrUtils import DynFlags -import Util ( listLengthCmp ) +import Util import Outputable \end{code} diff --git a/compiler/coreSyn/CoreSubst.lhs b/compiler/coreSyn/CoreSubst.lhs index 983f2a8..6eecc27 100644 --- a/compiler/coreSyn/CoreSubst.lhs +++ b/compiler/coreSyn/CoreSubst.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[CoreUtils]{Utility functions on @Core@ syntax} + +Utility functions on @Core@ syntax \begin{code} module CoreSubst ( @@ -24,29 +26,23 @@ module CoreSubst ( #include "HsVersions.h" -import CoreSyn ( Expr(..), Bind(..), CoreExpr, CoreBind, - CoreRule(..), hasUnfolding, noUnfolding - ) -import CoreFVs ( exprFreeVars ) -import CoreUtils ( exprIsTrivial ) +import CoreSyn +import CoreFVs +import CoreUtils -import qualified Type ( substTy, substTyVarBndr ) -import Type ( Type, tyVarsOfType, TvSubstEnv, TvSubst(..), mkTyVarTy ) +import qualified Type +import Type ( Type, TvSubst(..), TvSubstEnv ) import VarSet import VarEnv -import Var ( setVarUnique, isId ) -import Id ( idType, idInfo, setIdType, maybeModifyIdInfo, isLocalId ) -import IdInfo ( IdInfo, SpecInfo(..), specInfo, setSpecInfo, isEmptySpecInfo, - unfoldingInfo, setUnfoldingInfo, seqSpecInfo, - WorkerInfo(..), workerExists, workerInfo, setWorkerInfo - ) -import Unique ( Unique ) -import UniqSupply ( UniqSupply, uniqFromSupply, uniqsFromSupply ) -import Var ( Var, Id, TyVar, isTyVar ) -import Maybes ( orElse ) +import Id +import Var ( Var, TyVar, setVarUnique ) +import IdInfo +import Unique +import UniqSupply +import Maybes import Outputable import PprCore () -- Instances -import Util ( mapAccumL ) +import Util import FastTypes \end{code} @@ -148,7 +144,7 @@ lookupIdSubst (Subst in_scope ids tvs) v -} lookupTvSubst :: Subst -> TyVar -> Type -lookupTvSubst (Subst _ ids tvs) v = lookupVarEnv tvs v `orElse` mkTyVarTy v +lookupTvSubst (Subst _ ids tvs) v = lookupVarEnv tvs v `orElse` Type.mkTyVarTy v ------------------------------ isInScope :: Var -> Subst -> Bool @@ -279,7 +275,8 @@ substIdBndr rec_subst subst@(Subst in_scope env tvs) old_id | otherwise = setIdType id1 (substTy subst old_ty) old_ty = idType old_id - no_type_change = isEmptyVarEnv tvs || isEmptyVarSet (tyVarsOfType old_ty) + no_type_change = isEmptyVarEnv tvs || + isEmptyVarSet (Type.tyVarsOfType old_ty) -- new_id has the right IdInfo -- The lazy-set is because we're in a loop here, with @@ -361,7 +358,7 @@ substTy (Subst in_scope id_env tv_env) ty \begin{code} substIdType :: Subst -> Id -> Id substIdType subst@(Subst in_scope id_env tv_env) id - | isEmptyVarEnv tv_env || isEmptyVarSet (tyVarsOfType old_ty) = id + | isEmptyVarEnv tv_env || isEmptyVarSet (Type.tyVarsOfType old_ty) = id | otherwise = setIdType id (substTy subst old_ty) -- The tyVarsOfType is cheaper than it looks -- because we cache the free tyvars of the type @@ -425,5 +422,5 @@ substVarSet subst fvs where subst_fv subst fv | isId fv = exprFreeVars (lookupIdSubst subst fv) - | otherwise = tyVarsOfType (lookupTvSubst subst fv) + | otherwise = Type.tyVarsOfType (lookupTvSubst subst fv) \end{code} diff --git a/compiler/coreSyn/CoreSyn.lhs b/compiler/coreSyn/CoreSyn.lhs index f5627e7..3c98f28 100644 --- a/compiler/coreSyn/CoreSyn.lhs +++ b/compiler/coreSyn/CoreSyn.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[CoreSyn]{A data type for the Haskell compiler midsection} + +CoreSyn: A data type for the Haskell compiler midsection \begin{code} module CoreSyn ( @@ -46,16 +48,16 @@ module CoreSyn ( #include "HsVersions.h" -import StaticFlags ( opt_RuntimeTypes ) -import CostCentre ( CostCentre, noCostCentre ) -import Var ( Var, Id, TyVar, isTyVar, isId ) -import Type ( Type, mkTyVarTy, seqType ) -import Coercion ( Coercion ) -import Name ( Name ) -import OccName ( OccName ) -import Literal ( Literal, mkMachInt ) -import DataCon ( DataCon, dataConWorkId, dataConTag ) -import BasicTypes ( Activation ) +import StaticFlags +import CostCentre +import Var +import Type +import Coercion +import Name +import OccName +import Literal +import DataCon +import BasicTypes import FastString import Outputable diff --git a/compiler/coreSyn/CoreTidy.lhs b/compiler/coreSyn/CoreTidy.lhs index bacf64f..c4e7ed9 100644 --- a/compiler/coreSyn/CoreTidy.lhs +++ b/compiler/coreSyn/CoreTidy.lhs @@ -1,7 +1,11 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1996-1998 % +This module contains "tidying" code for *nested* expressions, bindings, rules. +The code for *top-level* bindings is in TidyPgm. + \begin{code} module CoreTidy ( tidyExpr, tidyVarOcc, tidyRule, tidyRules @@ -10,27 +14,21 @@ module CoreTidy ( #include "HsVersions.h" import CoreSyn -import CoreUtils ( exprArity ) -import Id ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, idType ) -import IdInfo ( setArityInfo, vanillaIdInfo, - newStrictnessInfo, setAllStrictnessInfo, - newDemandInfo, setNewDemandInfo ) -import Type ( tidyType, tidyTyVarBndr ) -import Var ( Var, varName ) +import CoreUtils +import Id +import IdInfo +import Type +import Var import VarEnv -import UniqFM ( lookupUFM ) -import Name ( Name, getOccName ) -import OccName ( tidyOccName ) -import SrcLoc ( noSrcLoc ) -import Maybes ( orElse ) -import Outputable -import Util ( mapAccumL ) +import UniqFM +import Name hiding (tidyNameOcc) +import OccName +import SrcLoc +import Maybes +import Util \end{code} -This module contains "tidying" code for *nested* expressions, bindings, rules. -The code for *top-level* bindings is in TidyPgm. - %************************************************************************ %* * \subsection{Tidying expressions, rules} @@ -115,7 +113,7 @@ tidyNameOcc :: TidyEnv -> Name -> Name -- Fortunately, we can lookup in the VarEnv with a name tidyNameOcc (_, var_env) n = case lookupUFM var_env n of Nothing -> n - Just v -> varName v + Just v -> idName v tidyVarOcc :: TidyEnv -> Var -> Var tidyVarOcc (_, var_env) v = lookupVarEnv var_env v `orElse` v diff --git a/compiler/coreSyn/CoreUnfold.lhs b/compiler/coreSyn/CoreUnfold.lhs index ad2a391..14413f4 100644 --- a/compiler/coreSyn/CoreUnfold.lhs +++ b/compiler/coreSyn/CoreUnfold.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1994-1998 % -\section[CoreUnfold]{Core-syntax unfoldings} + +Core-syntax unfoldings Unfoldings (which can travel across module boundaries) are in Core syntax (namely @CoreExpr@s). @@ -30,31 +32,24 @@ module CoreUnfold ( #include "HsVersions.h" -import StaticFlags ( opt_UF_CreationThreshold, opt_UF_UseThreshold, - opt_UF_FunAppDiscount, opt_UF_KeenessFactor, - opt_UF_DearOp, - ) -import DynFlags ( DynFlags, DynFlag(..), dopt ) +import StaticFlags +import DynFlags import CoreSyn import PprCore () -- Instances -import OccurAnal ( occurAnalyseExpr ) -import CoreUtils ( exprIsHNF, exprIsCheap, exprIsTrivial ) -import Id ( Id, idType, isId, - idUnfolding, globalIdDetails - ) -import DataCon ( isUnboxedTupleCon ) -import Literal ( litSize ) -import PrimOp ( primOpIsDupable, primOpOutOfLine ) -import IdInfo ( GlobalIdDetails(..) ) -import Type ( isUnLiftedType ) -import PrelNames ( hasKey, buildIdKey, augmentIdKey ) +import OccurAnal +import CoreUtils +import Id +import DataCon +import Literal +import PrimOp +import IdInfo +import Type +import PrelNames import Bag import FastTypes import Outputable -#if __GLASGOW_HASKELL__ >= 404 -import GLAEXTS ( Int# ) -#endif +import GHC.Exts ( Int# ) \end{code} diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs index 38e4a11..ddeffb7 100644 --- a/compiler/coreSyn/CoreUtils.lhs +++ b/compiler/coreSyn/CoreUtils.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[CoreUtils]{Utility functions on @Core@ syntax} + +Utility functions on @Core@ syntax \begin{code} module CoreUtils ( @@ -38,57 +40,41 @@ module CoreUtils ( #include "HsVersions.h" - -import GLAEXTS -- For `xori` - import CoreSyn -import CoreFVs ( exprFreeVars ) -import PprCore ( pprCoreExpr ) -import Var ( Var, TyVar, CoVar, tyVarKind, mkCoVar, mkTyVar ) -import OccName ( mkVarOccFS ) -import SrcLoc ( noSrcLoc ) -import VarSet ( unionVarSet ) +import CoreFVs +import PprCore +import Var +import SrcLoc +import VarSet import VarEnv -import Name ( hashName, mkSysTvName ) +import Name #if mingw32_TARGET_OS -import Packages ( isDllName ) +import Packages #endif -import Literal ( hashLiteral, literalType, litIsDupable, - litIsTrivial, isZeroLit, Literal( MachLabel ) ) -import DataCon ( DataCon, dataConRepArity, eqSpecPreds, - dataConTyCon, dataConRepArgTys, - dataConUnivTyVars, dataConExTyVars, dataConEqSpec, - dataConOrigArgTys, dataConTheta ) -import PrimOp ( PrimOp(..), primOpOkForSpeculation, primOpIsCheap ) -import Id ( Id, idType, globalIdDetails, idNewStrictness, - mkWildId, idArity, idName, idUnfolding, idInfo, - isOneShotBndr, isStateHackType, - isDataConWorkId_maybe, mkSysLocal, mkUserLocal, - isDataConWorkId, isBottomingId, isDictId - ) -import IdInfo ( GlobalIdDetails(..), megaSeqIdInfo ) -import NewDemand ( appIsBottom ) -import Type ( Type, mkFunTy, mkForAllTy, splitFunTy_maybe, - splitFunTy, tcEqTypeX, - applyTys, isUnLiftedType, seqType, mkTyVarTy, - splitForAllTy_maybe, isForAllTy, - splitTyConApp_maybe, splitTyConApp, coreEqType, funResultTy, applyTy, - substTyWith, mkPredTy, zipOpenTvSubst, substTy, substTyVar - ) -import Coercion ( Coercion, mkTransCoercion, coercionKind, - splitNewTypeRepCo_maybe, mkSymCoercion, - decomposeCo, coercionKindPredTy ) -import TyCon ( tyConArity ) -import TysWiredIn ( boolTy, trueDataCon, falseDataCon ) -import CostCentre ( CostCentre ) -import BasicTypes ( Arity ) -import PackageConfig ( PackageId ) -import Unique ( Unique ) +import Literal +import DataCon +import PrimOp +import Id +import IdInfo +import NewDemand +import Type +import Coercion +import TyCon +import TysWiredIn +import CostCentre +import BasicTypes +import PackageConfig +import Unique import Outputable -import DynFlags ( DynFlags, DynFlag(Opt_DictsCheap), dopt ) -import TysPrim ( alphaTy ) -- Debugging only -import Util ( equalLength, lengthAtLeast, foldl2 ) -import FastString ( FastString ) +import DynFlags +import TysPrim +import FastString + +#ifdef DEBUG +import Util +#endif + +import GHC.Exts -- For `xori` \end{code} diff --git a/compiler/coreSyn/ExternalCore.lhs b/compiler/coreSyn/ExternalCore.lhs index 8c00131..c5035e2 100644 --- a/compiler/coreSyn/ExternalCore.lhs +++ b/compiler/coreSyn/ExternalCore.lhs @@ -1,5 +1,5 @@ % -% (c) The University of Glasgow 2001 +% (c) The University of Glasgow 2001-2006 % \begin{code} diff --git a/compiler/coreSyn/MkExternalCore.lhs b/compiler/coreSyn/MkExternalCore.lhs index 246bfa0..467cff5 100644 --- a/compiler/coreSyn/MkExternalCore.lhs +++ b/compiler/coreSyn/MkExternalCore.lhs @@ -1,5 +1,5 @@ -% (c) The University of Glasgow 2001 +% (c) The University of Glasgow 2001-2006 % \begin{code} @@ -18,19 +18,18 @@ import TyCon import TypeRep import Type import PprExternalCore -- Instances -import DataCon ( DataCon, dataConExTyVars, dataConRepArgTys, - dataConName, dataConTyCon ) +import DataCon import CoreSyn import Var import IdInfo import Literal import Name -import NameSet ( NameSet, emptyNameSet ) -import UniqSet ( elementOfUniqSet ) +import NameSet +import UniqSet import Outputable import ForeignCall -import DynFlags ( DynFlags(..) ) -import StaticFlags ( opt_EmitExternalCore ) +import DynFlags +import StaticFlags import IO import FastString diff --git a/compiler/coreSyn/PprCore.lhs b/compiler/coreSyn/PprCore.lhs index 8713e74..8023b98 100644 --- a/compiler/coreSyn/PprCore.lhs +++ b/compiler/coreSyn/PprCore.lhs @@ -1,11 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1996-1998 % -%************************************************************************ -%* * -\section[PprCore]{Printing of Core syntax, including for interfaces} -%* * -%************************************************************************ + +Printing of Core syntax \begin{code} module PprCore ( @@ -17,34 +15,24 @@ module PprCore ( #include "HsVersions.h" import CoreSyn -import CostCentre ( pprCostCentreCore ) -import Var ( Var ) -import Id ( Id, idType, isDataConWorkId_maybe, idArity, - idInfo, globalIdDetails, isGlobalId, isExportedId - ) -import Var ( TyVar, isTyVar, tyVarKind ) -import IdInfo ( IdInfo, megaSeqIdInfo, - inlinePragInfo, occInfo, newDemandInfo, - lbvarInfo, hasNoLBVarInfo, - arityInfo, ppArityInfo, - specInfo, pprNewStrictness, - workerInfo, ppWorkerInfo, - newStrictnessInfo, cafInfo, ppCafInfo, specInfoRules - ) -import NewDemand ( isTop ) +import CostCentre +import Var +import Id +import IdInfo +import NewDemand #ifdef OLD_STRICTNESS -import Id ( idDemandInfo ) -import IdInfo ( cprInfo, ppCprInfo, strictnessInfo, ppStrictnessInfo ) +import Id +import IdInfo #endif -import DataCon ( dataConTyCon ) -import TyCon ( tupleTyConBoxity, isTupleTyCon ) -import Type ( pprParendType, pprType, pprParendKind ) -import Coercion ( coercionKindPredTy ) -import BasicTypes ( tupleParens, isNoOcc, isAlwaysActive ) -import Util ( lengthIs ) +import DataCon +import TyCon +import Type +import Coercion +import BasicTypes +import Util import Outputable -import FastString ( mkFastString ) +import FastString \end{code} %************************************************************************ diff --git a/compiler/coreSyn/PprExternalCore.lhs b/compiler/coreSyn/PprExternalCore.lhs index b568f63..fe29131 100644 --- a/compiler/coreSyn/PprExternalCore.lhs +++ b/compiler/coreSyn/PprExternalCore.lhs @@ -1,14 +1,14 @@ % -% (c) The University of Glasgow 2001 +% (c) The University of Glasgow 2001-2006 % -\begin{code} +\begin{code} module PprExternalCore () where import Pretty import ExternalCore import Char -import Encoding ( zEncodeString ) +import Encoding instance Show Module where showsPrec d m = shows (pmodule m) diff --git a/compiler/cprAnalysis/CprAnalyse.lhs b/compiler/cprAnalysis/CprAnalyse.lhs index dad6ccb..d337d02 100644 --- a/compiler/cprAnalysis/CprAnalyse.lhs +++ b/compiler/cprAnalysis/CprAnalyse.lhs @@ -1,3 +1,5 @@ +% (c) The University of Glasgow 2006 + \section[CprAnalyse]{Identify functions that always return a constructed product result} @@ -11,16 +13,15 @@ module CprAnalyse ( cprAnalyse ) where #include "HsVersions.h" -import DynFlags ( DynFlags, DynFlag(..) ) -import CoreLint ( showPass, endPass ) +import DynFlags +import CoreLint import CoreSyn -import CoreUtils ( exprIsHNF ) -import Id ( Id, setIdCprInfo, idCprInfo, idArity, - isBottomingId, idDemandInfo, isImplicitId ) -import IdInfo ( CprInfo(..) ) -import Demand ( isStrict ) +import CoreUtils +import Id +import IdInfo +import Demand import VarEnv -import Util ( nTimes, mapAccumL ) +import Util import Outputable import Maybe diff --git a/compiler/deSugar/Check.lhs b/compiler/deSugar/Check.lhs index dbf2d72..15fcf39 100644 --- a/compiler/deSugar/Check.lhs +++ b/compiler/deSugar/Check.lhs @@ -1,36 +1,31 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1997-1998 % % Author: Juan J. Quintela -\section{Module @Check@ in @deSugar@} \begin{code} - - module Check ( check , ExhaustivePat ) where +#include "HsVersions.h" import HsSyn -import TcHsSyn ( hsLPatType, mkVanillaTuplePat ) -import TcType ( tcTyConAppTyCon ) -import DsUtils ( EquationInfo(..), MatchResult(..), - CanItFail(..), firstPat ) -import MatchLit ( tidyLitPat, tidyNPat ) -import Id ( Id, idType ) -import DataCon ( DataCon, dataConTyCon, dataConOrigArgTys, dataConFieldLabels ) -import Name ( Name, mkInternalName, getOccName, isDataSymOcc, - getName, mkVarOccFS ) +import TcHsSyn +import TcType +import DsUtils +import MatchLit +import Id +import DataCon +import Name import TysWiredIn -import PrelNames ( unboundKey ) -import TyCon ( tyConDataCons, tupleTyConBoxity, isTupleTyCon ) -import BasicTypes ( Boxity(..) ) -import SrcLoc ( noSrcLoc, Located(..), unLoc, noLoc ) +import PrelNames +import TyCon +import BasicTypes +import SrcLoc import UniqSet -import Util ( takeList, splitAtList, notNull ) +import Util import Outputable import FastString - -#include "HsVersions.h" \end{code} This module performs checks about if one list of equations are: diff --git a/compiler/deSugar/Desugar.lhs b/compiler/deSugar/Desugar.lhs index 29801f2..8fcaf9b 100644 --- a/compiler/deSugar/Desugar.lhs +++ b/compiler/deSugar/Desugar.lhs @@ -1,50 +1,49 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[Desugar]{@deSugar@: the main function} + +The Desugarer: turning HsSyn into Core. \begin{code} module Desugar ( deSugar, deSugarExpr ) where #include "HsVersions.h" -import DynFlags ( DynFlag(..), DynFlags(..), dopt, GhcMode(..) ) -import StaticFlags ( opt_SccProfilingOn, - opt_AutoSccsOnAllToplevs, - opt_AutoSccsOnExportedToplevs ) -import DriverPhases ( isHsBoot ) -import HscTypes ( ModGuts(..), HscEnv(..), availsToNameSet, - Dependencies(..), ForeignStubs(..), TypeEnv, IsBootInterface ) -import HsSyn ( RuleDecl(..), RuleBndr(..), LHsExpr, LRuleDecl ) -import TcRnTypes ( TcGblEnv(..), ImportAvails(..) ) -import MkIface ( mkUsageInfo ) -import Id ( Id, setIdExported, idName ) -import Name ( Name, isExternalName, nameIsLocalOrFrom, nameOccName ) +import DynFlags +import StaticFlags +import HscTypes +import HsSyn +import TcRnTypes +import MkIface +import Id +import Name import CoreSyn -import PprCore ( pprRules, pprCoreExpr ) +import PprCore import DsMonad -import DsExpr ( dsLExpr ) -import DsBinds ( dsTopLHsBinds, decomposeRuleLhs, AutoScc(..) ) -import DsForeign ( dsForeigns ) +import DsExpr +import DsBinds +import DsForeign import DsExpr () -- Forces DsExpr to be compiled; DsBinds only -- depends on DsExpr.hi-boot. import Module -import UniqFM ( eltsUFM, delFromUFM ) -import PackageConfig ( thPackageId ) -import RdrName ( GlobalRdrEnv ) +import UniqFM +import PackageConfig +import RdrName import NameSet import VarSet -import Rules ( roughTopNames ) -import CoreLint ( showPass, endPass ) -import CoreFVs ( ruleRhsFreeVars, exprsFreeNames ) -import ErrUtils ( doIfSet, dumpIfSet_dyn ) -import ListSetOps ( insertList ) +import Rules +import CoreLint +import CoreFVs +import ErrUtils +import ListSetOps import Outputable -import SrcLoc ( Located(..) ) -import DATA_IOREF ( readIORef ) -import Maybes ( catMaybes ) +import SrcLoc +import Maybes import FastString -import Util ( sortLe ) +import Util + +import Data.IORef \end{code} %************************************************************************ diff --git a/compiler/deSugar/DsArrows.lhs b/compiler/deSugar/DsArrows.lhs index 4251b20..4d9295d 100644 --- a/compiler/deSugar/DsArrows.lhs +++ b/compiler/deSugar/DsArrows.lhs @@ -1,23 +1,21 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsArrows]{Desugaring arrow commands} + +Desugaring arrow commands \begin{code} module DsArrows ( dsProcExpr ) where #include "HsVersions.h" -import Match ( matchSimply ) -import DsUtils ( mkErrorAppDs, - mkCoreTupTy, mkCoreTup, selectSimpleMatchVarL, - mkTupleCase, mkBigCoreTup, mkTupleType, - mkTupleExpr, mkTupleSelector, - dsSyntaxTable, lookupEvidence ) +import Match +import DsUtils import DsMonad import HsSyn -import TcHsSyn ( hsLPatType ) +import TcHsSyn -- NB: The desugarer, which straddles the source and Core worlds, sometimes -- needs to see source types (newtypes etc), and sometimes not @@ -26,29 +24,24 @@ import TcHsSyn ( hsLPatType ) import {-# SOURCE #-} DsExpr ( dsExpr, dsLExpr, dsLocalBinds ) -import TcType ( Type, tcSplitAppTy, mkFunTy ) -import Type ( mkTyConApp, funArgTy ) +import TcType +import Type import CoreSyn -import CoreFVs ( exprFreeVars ) -import CoreUtils ( mkIfThenElse, bindNonRec, exprType ) - -import Id ( Id, idType ) -import Name ( Name ) -import PrelInfo ( pAT_ERROR_ID ) -import DataCon ( dataConWrapId ) -import TysWiredIn ( tupleCon ) -import BasicTypes ( Boxity(..) ) -import PrelNames ( eitherTyConName, leftDataConName, rightDataConName, - arrAName, composeAName, firstAName, - appAName, choiceAName, loopAName ) -import Util ( mapAccumL ) -import Outputable - -import HsUtils ( collectPatBinders, collectPatsBinders ) -import VarSet ( IdSet, mkVarSet, varSetElems, - intersectVarSet, minusVarSet, extendVarSetList, - unionVarSet, unionVarSets, elemVarSet ) -import SrcLoc ( Located(..), unLoc, noLoc ) +import CoreFVs +import CoreUtils + +import Id +import Name +import PrelInfo +import DataCon +import TysWiredIn +import BasicTypes +import PrelNames +import Util + +import HsUtils +import VarSet +import SrcLoc \end{code} \begin{code} diff --git a/compiler/deSugar/DsBinds.lhs b/compiler/deSugar/DsBinds.lhs index 85581c9..9fb2eaf 100644 --- a/compiler/deSugar/DsBinds.lhs +++ b/compiler/deSugar/DsBinds.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsBinds]{Pattern-matching bindings (HsBinds and MonoBinds)} + +Pattern-matching bindings (HsBinds and MonoBinds) Handles @HsBinds@; those at the top level require different handling, in that the @Rec@/@NonRec@/etc structure is thrown away (whereas at @@ -15,36 +17,36 @@ module DsBinds ( dsTopLHsBinds, dsLHsBinds, decomposeRuleLhs, #include "HsVersions.h" - import {-# SOURCE #-} DsExpr( dsLExpr, dsExpr ) import {-# SOURCE #-} Match( matchWrapper ) import DsMonad -import DsGRHSs ( dsGuarded ) +import DsGRHSs import DsUtils import HsSyn -- lots of things import CoreSyn -- lots of things -import CoreUtils ( exprType, mkInlineMe, mkSCC ) - -import OccurAnal ( occurAnalyseExpr ) -import CostCentre ( mkAutoCC, IsCafCC(..) ) -import Id ( Id, DictId, idType, idName, mkLocalId, setInlinePragma ) -import Rules ( addIdSpecialisations, mkLocalRule ) -import Var ( TyVar, Var, isGlobalId, setIdNotExported ) +import CoreUtils + +import OccurAnal +import CostCentre +import Module +import Id +import Rules +import Var ( TyVar, Var ) import VarEnv -import Type ( mkTyVarTy, substTyWith ) -import TysWiredIn ( voidTy ) -import Module ( Module ) +import Type +import TysWiredIn import Outputable -import SrcLoc ( Located(..) ) -import Maybes ( catMaybes, orElse ) -import Bag ( bagToList ) -import BasicTypes ( Activation(..), InlineSpec(..), isAlwaysActive ) -import Monad ( foldM ) -import FastString ( mkFastString ) -import List ( (\\) ) +import SrcLoc +import Maybes +import Bag +import BasicTypes hiding ( TopLevel ) +import FastString import Util ( mapSnd ) + +import Control.Monad +import Data.List \end{code} %************************************************************************ diff --git a/compiler/deSugar/DsCCall.lhs b/compiler/deSugar/DsCCall.lhs index a041665..fca20df 100644 --- a/compiler/deSugar/DsCCall.lhs +++ b/compiler/deSugar/DsCCall.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1994-1998 % -\section[DsCCall]{Desugaring C calls} + +Desugaring foreign calls \begin{code} module DsCCall @@ -19,48 +21,25 @@ import CoreSyn import DsMonad -import CoreUtils ( exprType, coreAltType, mkCoerce ) -import Id ( Id, mkWildId ) -import MkId ( mkFCallId, realWorldPrimId, mkPrimOpId ) -import Maybes ( maybeToBool ) -import ForeignCall ( ForeignCall(..), CCallSpec(..), CCallTarget(..), Safety, - CCallConv(..), CLabelString ) -import DataCon ( splitProductType_maybe, dataConSourceArity, dataConWrapId ) - -import TcType ( tcSplitIOType_maybe ) -import Type ( Type, isUnLiftedType, mkFunTys, mkFunTy, - tyVarsOfType, mkForAllTys, mkTyConApp, - isPrimitiveType, splitTyConApp_maybe, - splitRecNewType_maybe, splitForAllTy_maybe, - isUnboxedTupleType - ) -import Coercion ( Coercion, splitNewTypeRepCo_maybe, mkSymCoercion ) -import PrimOp ( PrimOp(..) ) -import TysPrim ( realWorldStatePrimTy, intPrimTy, - byteArrayPrimTyCon, mutableByteArrayPrimTyCon, - addrPrimTy - ) -import TyCon ( TyCon, tyConDataCons, tyConName ) -import TysWiredIn ( unitDataConId, - unboxedSingletonDataCon, unboxedPairDataCon, - unboxedSingletonTyCon, unboxedPairTyCon, - trueDataCon, falseDataCon, - trueDataConId, falseDataConId, - listTyCon, charTyCon, boolTy, - tupleTyCon, tupleCon - ) -import BasicTypes ( Boxity(..) ) -import Literal ( mkMachInt ) -import PrelNames ( Unique, hasKey, boolTyConKey, unitTyConKey, - int8TyConKey, int16TyConKey, int32TyConKey, - word8TyConKey, word16TyConKey, word32TyConKey - -- dotnet interop - , marshalStringName, unmarshalStringName - , marshalObjectName, unmarshalObjectName - , objectTyConName - ) -import VarSet ( varSetElems ) -import Constants ( wORD_SIZE) +import CoreUtils +import Id +import MkId +import Maybes +import ForeignCall +import DataCon + +import TcType +import Type +import Coercion +import PrimOp +import TysPrim +import TyCon +import TysWiredIn +import BasicTypes +import Literal +import PrelNames +import VarSet +import Constants import Outputable #ifdef DEBUG diff --git a/compiler/deSugar/DsExpr.lhs b/compiler/deSugar/DsExpr.lhs index a85f100..4a5521c 100644 --- a/compiler/deSugar/DsExpr.lhs +++ b/compiler/deSugar/DsExpr.lhs @@ -1,66 +1,59 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsExpr]{Matching expressions (Exprs)} + +Desugaring exporessions. \begin{code} module DsExpr ( dsExpr, dsLExpr, dsLocalBinds, dsValBinds, dsLit ) where #include "HsVersions.h" #if defined(GHCI) && defined(BREAKPOINT) -import Foreign.StablePtr ( newStablePtr, castStablePtrToPtr ) -import GHC.Exts ( Ptr(..), Int(..), addr2Int# ) -import IOEnv ( ioToIOEnv ) -import PrelNames ( breakpointJumpName, breakpointCondJumpName ) -import TysWiredIn ( unitTy ) -import TypeRep ( Type(..) ) -import TyCon ( isUnLiftedTyCon ) +import Foreign.StablePtr +import GHC.Exts +import IOEnv +import PrelNames +import TysWiredIn +import TypeRep +import TyCon #endif -import Match ( matchWrapper, matchSinglePat, matchEquations ) -import MatchLit ( dsLit, dsOverLit ) -import DsBinds ( dsLHsBinds, dsCoercion ) -import DsGRHSs ( dsGuarded ) -import DsListComp ( dsListComp, dsPArrComp ) -import DsUtils ( mkErrorAppDs, mkStringExpr, mkConsExpr, mkNilExpr, - extractMatchResult, cantFailMatchResult, matchCanFail, - mkCoreTupTy, selectSimpleMatchVarL, lookupEvidence, selectMatchVar ) -import DsArrows ( dsProcExpr ) +import Match +import MatchLit +import DsBinds +import DsGRHSs +import DsListComp +import DsUtils +import DsArrows import DsMonad #ifdef GHCI -- Template Haskell stuff iff bootstrapped -import DsMeta ( dsBracket ) +import DsMeta #endif import HsSyn -import TcHsSyn ( hsLPatType, mkVanillaTuplePat ) +import TcHsSyn -- NB: The desugarer, which straddles the source and Core worlds, sometimes --- needs to see source types (newtypes etc), and sometimes not --- So WATCH OUT; check each use of split*Ty functions. --- Sigh. This is a pain. - -import TcType ( tcSplitAppTy, tcSplitFunTys, tcTyConAppTyCon, - tcTyConAppArgs, isUnLiftedType, Type, mkAppTy ) -import Type ( splitFunTys, isUnboxedTupleType, mkFunTy ) +-- needs to see source types +import TcType +import Type import CoreSyn -import CoreUtils ( exprType, mkIfThenElse, bindNonRec ) - -import CostCentre ( mkUserCC ) -import Id ( Id, idType, idName, idDataCon ) -import PrelInfo ( rEC_CON_ERROR_ID ) -import DataCon ( DataCon, dataConWrapId, dataConFieldLabels, dataConInstOrigArgTys ) -import DataCon ( isVanillaDataCon ) -import TyCon ( FieldLabel, tyConDataCons ) -import TysWiredIn ( tupleCon ) -import BasicTypes ( RecFlag(..), Boxity(..), ipNameName ) -import PrelNames ( toPName, - returnMName, bindMName, thenMName, failMName, - mfixName ) -import SrcLoc ( Located(..), unLoc, getLoc, noLoc ) -import Util ( zipEqual, zipWithEqual ) -import Bag ( bagToList ) +import CoreUtils + +import CostCentre +import Id +import PrelInfo +import DataCon +import TyCon +import TysWiredIn +import BasicTypes +import PrelNames +import SrcLoc +import Util +import Bag import Outputable import FastString \end{code} diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs index 462da0e..ba19124 100644 --- a/compiler/deSugar/DsForeign.lhs +++ b/compiler/deSugar/DsForeign.lhs @@ -1,9 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1998 % -\section[DsCCall]{Desugaring \tr{foreign} declarations} -Expanding out @foreign import@ and @foreign export@ declarations. +Desugaring foreign declarations (see also DsCCall). \begin{code} module DsForeign ( dsForeigns ) where @@ -13,48 +13,33 @@ import TcRnMonad -- temp import CoreSyn -import DsCCall ( dsCCall, mkFCall, boxResult, unboxArg, resultWrapper ) +import DsCCall import DsMonad -import HsSyn ( ForeignDecl(..), ForeignExport(..), LForeignDecl, - ForeignImport(..), CImportSpec(..) ) -import DataCon ( splitProductType_maybe ) -#ifdef DEBUG -import DataCon ( dataConSourceArity ) -import Type ( isUnLiftedType ) -#endif -import MachOp ( machRepByteWidth, MachRep(..) ) -import SMRep ( argMachRep, typeCgRep ) -import CoreUtils ( exprType, mkInlineMe ) -import Id ( Id, idType, idName, mkSysLocal, setInlinePragma ) -import Literal ( Literal(..), mkStringLit ) -import Module ( moduleNameFS, moduleName ) -import Name ( getOccString, NamedThing(..) ) -import Type ( repType, coreEqType ) -import Coercion ( mkUnsafeCoercion ) -import TcType ( Type, mkFunTys, mkForAllTys, mkTyConApp, - mkFunTy, tcSplitTyConApp_maybe, tcSplitIOType_maybe, - tcSplitForAllTys, tcSplitFunTys, tcTyConAppArgs, - isBoolTy - ) - -import BasicTypes ( Boxity(..) ) -import HscTypes ( ForeignStubs(..) ) -import ForeignCall ( ForeignCall(..), CCallSpec(..), - Safety(..), - CExportSpec(..), CLabelString, - CCallConv(..), ccallConvToInt, - ccallConvAttribute - ) -import TysWiredIn ( unitTy, tupleTyCon ) -import TysPrim ( addrPrimTy, mkStablePtrPrimTy, alphaTy, intPrimTy ) -import PrelNames ( stablePtrTyConName, newStablePtrName, bindIOName, - checkDotnetResName ) -import BasicTypes ( Activation( NeverActive ) ) -import SrcLoc ( Located(..), unLoc ) +import HsSyn +import DataCon +import MachOp +import SMRep +import CoreUtils +import Id +import Literal +import Module +import Name +import Type +import Coercion +import TcType + +import HscTypes +import ForeignCall +import TysWiredIn +import TysPrim +import PrelNames +import BasicTypes +import SrcLoc import Outputable -import Maybe ( fromJust, isNothing ) import FastString + +import Data.Maybe \end{code} Desugaring of @foreign@ declarations is naturally split up into diff --git a/compiler/deSugar/DsGRHSs.lhs b/compiler/deSugar/DsGRHSs.lhs index a8571f1..93f4ead 100644 --- a/compiler/deSugar/DsGRHSs.lhs +++ b/compiler/deSugar/DsGRHSs.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsGRHSs]{Matching guarded right-hand-sides (GRHSs)} + +Matching guarded right-hand-sides (GRHSs) \begin{code} module DsGRHSs ( dsGuarded, dsGRHSs ) where @@ -11,20 +13,19 @@ module DsGRHSs ( dsGuarded, dsGRHSs ) where import {-# SOURCE #-} DsExpr ( dsLExpr, dsLocalBinds ) import {-# SOURCE #-} Match ( matchSinglePat ) -import HsSyn ( Stmt(..), HsExpr(..), GRHSs(..), GRHS(..), - LHsExpr, HsMatchContext(..), Pat(..) ) -import CoreSyn ( CoreExpr ) -import Var ( Id ) -import Type ( Type ) +import HsSyn +import CoreSyn +import Var +import Type import DsMonad import DsUtils -import Unique ( Uniquable(..) ) -import PrelInfo ( nON_EXHAUSTIVE_GUARDS_ERROR_ID ) -import TysWiredIn ( trueDataConId ) -import PrelNames ( otherwiseIdKey, hasKey ) -import Name ( Name ) -import SrcLoc ( unLoc, Located(..) ) +import Unique +import PrelInfo +import TysWiredIn +import PrelNames +import Name +import SrcLoc \end{code} @dsGuarded@ is used for both @case@ expressions and pattern bindings. diff --git a/compiler/deSugar/DsListComp.lhs b/compiler/deSugar/DsListComp.lhs index 2827fb6..7409101 100644 --- a/compiler/deSugar/DsListComp.lhs +++ b/compiler/deSugar/DsListComp.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsListComp]{Desugaring list comprehensions and array comprehensions} + +Desugaring list comprehensions and array comprehensions \begin{code} module DsListComp ( dsListComp, dsPArrComp ) where @@ -10,30 +12,26 @@ module DsListComp ( dsListComp, dsPArrComp ) where import {-# SOURCE #-} DsExpr ( dsLExpr, dsLocalBinds ) -import BasicTypes ( Boxity(..) ) +import BasicTypes import HsSyn -import TcHsSyn ( hsLPatType, mkVanillaTuplePat ) +import TcHsSyn import CoreSyn import DsMonad -- the monadery used in the desugarer import DsUtils -import DynFlags ( DynFlag(..), dopt ) -import StaticFlags ( opt_RulesOff ) -import CoreUtils ( exprType, mkIfThenElse ) -import Id ( idType ) -import Var ( Id ) -import Type ( mkTyVarTy, mkFunTys, mkFunTy, Type, - splitTyConApp_maybe ) -import TysPrim ( alphaTyVar ) -import TysWiredIn ( nilDataCon, consDataCon, trueDataConId, falseDataConId, - unitDataConId, unitTy, mkListTy, parrTyCon ) -import Match ( matchSimply ) -import PrelNames ( foldrName, buildName, replicatePName, mapPName, - filterPName, zipPName, crossPName ) -import PrelInfo ( pAT_ERROR_ID ) -import SrcLoc ( noLoc, unLoc ) -import Panic ( panic ) +import DynFlags +import StaticFlags +import CoreUtils +import Var +import Type +import TysPrim +import TysWiredIn +import Match +import PrelNames +import PrelInfo +import SrcLoc +import Panic \end{code} List comprehensions may be desugared in one of two ways: ``ordinary'' diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 6c04002..d859d86 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1,4 +1,7 @@ ----------------------------------------------------------------------------- +-- +-- (c) The University of Glasgow 2006 +-- -- The purpose of this module is to transform an HsExpr into a CoreExpr which -- when evaluated, returns a (Meta.Q Meta.Exp) computation analogous to the -- input HsExpr. We do this in the DsM monad, which supplies access to @@ -21,47 +24,45 @@ module DsMeta( dsBracket, import {-# SOURCE #-} DsExpr ( dsExpr ) -import MatchLit ( dsLit ) -import DsUtils ( mkListExpr, mkStringExpr, mkCoreTup, mkIntExpr ) +import MatchLit +import DsUtils import DsMonad import qualified Language.Haskell.TH as TH import HsSyn -import Class (FunDep) -import PrelNames ( rationalTyConName, integerTyConName, negateName ) -import OccName ( isDataOcc, isTvOcc, occNameString ) --- To avoid clashes with DsMeta.varName we must make a local alias for OccName.varName --- we do this by removing varName from the import of OccName above, making --- a qualified instance of OccName and using OccNameAlias.varName where varName --- ws previously used in this file. +import Class +import PrelNames +import OccName +-- To avoid clashes with DsMeta.varName we must make a local alias for +-- OccName.varName we do this by removing varName from the import of +-- OccName above, making a qualified instance of OccName and using +-- OccNameAlias.varName where varName ws previously used in this file. import qualified OccName -import Module ( Module, mkModule, moduleNameString, moduleName, - modulePackageId, mkModuleNameFS ) -import Id ( Id, mkLocalId ) -import OccName ( mkOccNameFS ) -import Name ( Name, mkExternalName, localiseName, nameOccName, nameModule, - isExternalName, getSrcLoc ) +import Module +import Id +import OccName +import Name import NameEnv -import Type ( Type, mkTyConApp ) -import TcType ( tcTyConAppArgs ) -import TyCon ( tyConName ) -import TysWiredIn ( parrTyCon ) +import Type +import TcType +import TyCon +import TysWiredIn import CoreSyn -import CoreUtils ( exprType ) -import SrcLoc ( noSrcLoc, unLoc, Located(..), SrcSpan, srcLocSpan ) -import PackageConfig ( thPackageId, packageIdString ) -import Unique ( mkPreludeTyConUnique, mkPreludeMiscIdUnique, getKey, Uniquable(..) ) -import BasicTypes ( isBoxed ) +import CoreUtils +import SrcLoc +import PackageConfig +import Unique +import BasicTypes import Outputable -import Bag ( bagToList, unionManyBags ) -import FastString ( unpackFS ) -import ForeignCall ( Safety(..), CCallConv(..), CCallTarget(..) ) +import Bag +import FastString +import ForeignCall -import Maybe ( catMaybes ) -import Monad ( zipWithM ) -import List ( sortBy ) +import Data.Maybe +import Control.Monad +import Data.List ----------------------------------------------------------------------------- dsBracket :: HsBracket Name -> [PendingSplice] -> DsM CoreExpr diff --git a/compiler/deSugar/DsMonad.lhs b/compiler/deSugar/DsMonad.lhs index 28ff62d..cbe182e 100644 --- a/compiler/deSugar/DsMonad.lhs +++ b/compiler/deSugar/DsMonad.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsMonad]{@DsMonad@: monadery used in desugaring} + +@DsMonad@: monadery used in desugaring \begin{code} module DsMonad ( @@ -33,29 +35,28 @@ module DsMonad ( #include "HsVersions.h" import TcRnMonad -import CoreSyn ( CoreExpr ) -import HsSyn ( HsExpr, HsMatchContext, Pat ) -import TcIface ( tcIfaceGlobal ) -import RdrName ( GlobalRdrEnv ) -import HscTypes ( TyThing(..), TypeEnv, HscEnv(..), - tyThingId, tyThingTyCon, tyThingDataCon, mkPrintUnqualified ) -import Bag ( emptyBag, snocBag ) -import DataCon ( DataCon ) -import TyCon ( TyCon ) -import Id ( mkSysLocal, setIdUnique, Id ) -import Module ( Module ) -import Var ( TyVar, setTyVarUnique ) +import CoreSyn +import HsSyn +import TcIface +import RdrName +import HscTypes +import Bag +import DataCon +import TyCon +import Id +import Module +import Var import Outputable -import SrcLoc ( noSrcSpan, SrcSpan ) -import Type ( Type ) -import UniqSupply ( UniqSupply, uniqsFromSupply ) -import Name ( Name, nameOccName ) +import SrcLoc +import Type +import UniqSupply +import Name import NameEnv -import OccName ( occNameFS ) -import DynFlags ( DynFlags ) -import ErrUtils ( Messages, mkWarnMsg, mkErrMsg, - printErrorsAndWarnings, errorsFound ) -import DATA_IOREF ( newIORef, readIORef ) +import OccName +import DynFlags +import ErrUtils + +import Data.IORef infixr 9 `thenDs` \end{code} diff --git a/compiler/deSugar/DsUtils.lhs b/compiler/deSugar/DsUtils.lhs index e2334f3..0552c2b 100644 --- a/compiler/deSugar/DsUtils.lhs +++ b/compiler/deSugar/DsUtils.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsUtils]{Utilities for desugaring} + +Utilities for desugaring This module exports some utility functions of no great interest. @@ -40,44 +42,36 @@ import {-# SOURCE #-} Match ( matchSimply ) import {-# SOURCE #-} DsExpr( dsExpr ) import HsSyn -import TcHsSyn ( hsLPatType, hsPatType ) +import TcHsSyn import CoreSyn -import Constants ( mAX_TUPLE_SIZE ) +import Constants import DsMonad -import CoreUtils ( exprType, mkIfThenElse, mkCoerce, bindNonRec ) -import MkId ( iRREFUT_PAT_ERROR_ID, mkReboxingAlt, unwrapNewTypeBody ) -import Id ( idType, Id, mkWildId, mkTemplateLocals, mkSysLocal ) -import Var ( Var ) -import Name ( Name ) -import Literal ( Literal(..), mkStringLit, inIntRange, tARGET_MAX_INT ) -import TyCon ( isNewTyCon, tyConDataCons ) -import DataCon ( DataCon, dataConSourceArity, dataConTyCon, dataConTag ) -import Type ( mkFunTy, isUnLiftedType, Type, splitTyConApp, mkTyVarTy, - splitNewTyConApp ) -import Coercion ( mkUnsafeCoercion ) -import TysPrim ( intPrimTy ) -import TysWiredIn ( nilDataCon, consDataCon, - tupleCon, mkTupleTy, - unitDataConId, unitTy, - charTy, charDataCon, - intTy, intDataCon, - isPArrFakeCon ) -import BasicTypes ( Boxity(..) ) -import UniqSet ( mkUniqSet, minusUniqSet, isEmptyUniqSet ) -import UniqSupply ( splitUniqSupply, uniqFromSupply, uniqsFromSupply ) -import PrelNames ( unpackCStringName, unpackCStringUtf8Name, - plusIntegerName, timesIntegerName, smallIntegerDataConName, - lengthPName, indexPName ) +import CoreUtils +import MkId +import Id +import Var +import Name +import Literal +import TyCon +import DataCon +import Type +import Coercion +import TysPrim +import TysWiredIn +import BasicTypes +import UniqSet +import UniqSupply +import PrelNames import Outputable -import SrcLoc ( Located(..), unLoc ) -import Util ( isSingleton, zipEqual, sortWith ) -import ListSetOps ( assocDefault ) +import SrcLoc +import Util +import ListSetOps import FastString -import Data.Char ( ord ) +import Data.Char #ifdef DEBUG -import Util ( notNull ) -- Used in an assertion +import Util #endif \end{code} diff --git a/compiler/deSugar/Match.lhs b/compiler/deSugar/Match.lhs index b40bb53..a31494e 100644 --- a/compiler/deSugar/Match.lhs +++ b/compiler/deSugar/Match.lhs @@ -1,40 +1,40 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[Main_match]{The @match@ function} + +The @match@ function \begin{code} module Match ( match, matchEquations, matchWrapper, matchSimply, matchSinglePat ) where #include "HsVersions.h" -import DynFlags ( DynFlag(..), dopt ) +import DynFlags import HsSyn -import TcHsSyn ( mkVanillaTuplePat, hsPatType ) -import Check ( check, ExhaustivePat ) +import TcHsSyn +import Check import CoreSyn -import Literal ( Literal ) -import CoreUtils ( bindNonRec, exprType ) +import Literal +import CoreUtils import DsMonad -import DsBinds ( dsLHsBinds, dsCoercion ) -import DsGRHSs ( dsGRHSs ) +import DsBinds +import DsGRHSs import DsUtils -import Id ( idName, idType, Id ) -import DataCon ( DataCon ) -import MatchCon ( matchConFamily ) -import MatchLit ( matchLiterals, matchNPlusKPats, matchNPats, - tidyLitPat, tidyNPat, hsLitKey, hsOverLitKey ) -import PrelInfo ( pAT_ERROR_ID ) -import TcType ( Type ) -import Type ( splitFunTysN, coreEqType ) -import TysWiredIn ( consDataCon, mkListTy, unitTy, - tupleCon, parrFakeCon, mkPArrTy ) -import BasicTypes ( Boxity(..) ) -import ListSetOps ( equivClasses, runs ) -import SrcLoc ( unLoc, Located(..) ) -import Maybes ( isJust ) -import Util ( lengthExceeds, notNull ) -import Name ( Name ) +import Id +import DataCon +import MatchCon +import MatchLit +import PrelInfo +import TcType +import Type +import TysWiredIn +import BasicTypes +import ListSetOps +import SrcLoc +import Maybes +import Util +import Name import Outputable \end{code} diff --git a/compiler/deSugar/MatchCon.lhs b/compiler/deSugar/MatchCon.lhs index c4c38b1..5233d59 100644 --- a/compiler/deSugar/MatchCon.lhs +++ b/compiler/deSugar/MatchCon.lhs @@ -1,7 +1,9 @@ - +% +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[MatchCon]{Pattern-matching constructors} + +Pattern-matching constructors \begin{code} module MatchCon ( matchConFamily ) where @@ -10,19 +12,17 @@ module MatchCon ( matchConFamily ) where import {-# SOURCE #-} Match ( match ) -import HsSyn ( Pat(..), LPat, HsConDetails(..), HsRecField(..) ) -import DsBinds ( dsLHsBinds ) -import DataCon ( DataCon, dataConInstOrigArgTys, dataConEqSpec, - dataConFieldLabels, dataConSourceArity ) -import TcType ( tcTyConAppArgs ) -import Type ( mkTyVarTys ) +import HsSyn +import DsBinds +import DataCon +import TcType +import Type import CoreSyn import DsMonad import DsUtils -import Id ( Id, idName ) -import Type ( Type ) -import SrcLoc ( unLoc, Located(..) ) +import Id +import SrcLoc import Outputable \end{code} diff --git a/compiler/deSugar/MatchLit.lhs b/compiler/deSugar/MatchLit.lhs index 3751f95..d7e8ba6 100644 --- a/compiler/deSugar/MatchLit.lhs +++ b/compiler/deSugar/MatchLit.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[MatchLit]{Pattern-matching literal patterns} + +Pattern-matching literal patterns \begin{code} module MatchLit ( dsLit, dsOverLit, hsLitKey, hsOverLitKey, @@ -17,24 +19,23 @@ import DsMonad import DsUtils import HsSyn -import Id ( Id, idType ) +import Id import CoreSyn -import TyCon ( tyConDataCons ) -import DataCon ( DataCon ) -import TcType ( tcSplitTyConApp, isIntegerTy, isIntTy, - isFloatTy, isDoubleTy, isStringTy ) -import Type ( Type ) -import PrelNames ( ratioTyConKey ) -import TysWiredIn ( stringTy, consDataCon, intDataCon, floatDataCon, doubleDataCon ) -import PrelNames ( eqStringName ) -import Unique ( hasKey ) -import Literal ( mkMachInt, Literal(..) ) -import SrcLoc ( noLoc ) -import Ratio ( numerator, denominator ) -import SrcLoc ( Located(..), unLoc ) +import TyCon +import DataCon +import TcType +import Type +import PrelNames +import TysWiredIn +import PrelNames +import Unique +import Literal +import SrcLoc +import Ratio +import SrcLoc import Outputable -import Util ( mapAndUnzip ) -import FastString ( lengthFS, unpackFS ) +import Util +import FastString \end{code} %************************************************************************ diff --git a/compiler/deSugar/deSugar.tex b/compiler/deSugar/deSugar.tex deleted file mode 100644 index 02cb285..0000000 --- a/compiler/deSugar/deSugar.tex +++ /dev/null @@ -1,23 +0,0 @@ -\documentstyle{report} -\input{lit-style} - -\begin{document} -\centerline{{\Large{deSugar}}} -\tableofcontents - -\input{Desugar} % {@deSugar@: the main function} -\input{DsBinds} % {Pattern-matching bindings (HsBinds and MonoBinds)} -\input{DsGRHSs} % {Matching guarded right-hand-sides (GRHSs)} -\input{DsExpr} % {Matching expressions (Exprs)} -\input{DsHsSyn} % {Haskell abstract syntax---added things for desugarer} -\input{DsListComp} % {Desugaring list comprehensions} -\input{DsMonad} % {@DsMonad@: monadery used in desugaring} -\input{DsUtils} % {Utilities for desugaring} -\input{Check} % {Module @Check@ in @deSugar@} -\input{Match} % {The @match@ function} -\input{MatchCon} % {Pattern-matching constructors} -\input{MatchLit} % {Pattern-matching literal patterns} -\input{DsForeign} % {Desugaring \tr{foreign} declarations} -\input{DsCCall} % {Desugaring \tr{_ccall_}s and \tr{_casm_}s} - -\end{document} diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs index 3e79a39..d47398c 100644 --- a/compiler/iface/BinIface.hs +++ b/compiler/iface/BinIface.hs @@ -1,7 +1,5 @@ -{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-} -{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-} -- --- (c) The University of Glasgow 2002 +-- (c) The University of Glasgow 2002-2006 -- -- Binary interface file support. @@ -9,45 +7,38 @@ module BinIface ( writeBinIface, readBinIface, v_IgnoreHiWay ) where #include "HsVersions.h" -import TcRnMonad ( TcRnIf, ioToIOEnv ) +import TcRnMonad import IfaceEnv import HscTypes import BasicTypes import NewDemand import IfaceSyn -import Module ( ModuleName, mkModule, modulePackageId, moduleName ) +import Module import Name -import OccName ( OccName ) +import OccName import VarEnv -import InstEnv ( OverlapFlag(..) ) -import Class ( DefMeth(..) ) -import DynFlags ( DynFlags ) -import UniqFM ( UniqFM, eltsUFM ) -import UniqSupply ( uniqFromSupply, splitUniqSupply ) +import InstEnv +import Class +import DynFlags +import UniqFM +import UniqSupply import CostCentre -import StaticFlags ( opt_HiVersion, v_Build_tag ) -import Type ( Kind, - isLiftedTypeKind, isUnliftedTypeKind, isOpenTypeKind, - isArgTypeKind, isUbxTupleKind, liftedTypeKind, - unliftedTypeKind, openTypeKind, argTypeKind, - ubxTupleKind, mkArrowKind, splitFunTy_maybe ) -import PackageConfig ( PackageId ) +import StaticFlags +import PackageConfig import Panic import Binary -import SrcLoc ( noSrcLoc ) +import SrcLoc import Util -import ErrUtils ( debugTraceMsg ) -import Config ( cGhcUnregisterised ) -import FastMutInt ( readFastMutInt ) - -import Data.Word ( Word32 ) -import Data.Array ( Array, array, elems, listArray, (!) ) -import DATA_IOREF -import EXCEPTION ( throwDyn ) -import Monad ( when ) +import ErrUtils +import Config +import FastMutInt import Outputable -#include "HsVersions.h" +import Data.Word +import Data.Array +import Data.IORef +import Control.Exception +import Control.Monad -- --------------------------------------------------------------------------- -- Reading and writing binary interface files diff --git a/compiler/iface/BuildTyCl.lhs b/compiler/iface/BuildTyCl.lhs index dfa8ba2..75d7234 100644 --- a/compiler/iface/BuildTyCl.lhs +++ b/compiler/iface/BuildTyCl.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % @@ -12,38 +13,24 @@ module BuildTyCl ( #include "HsVersions.h" -import IfaceEnv ( newImplicitBinder ) +import IfaceEnv import TcRnMonad -import DataCon ( DataCon, isNullarySrcDataCon, - mkDataCon, dataConFieldLabels, dataConInstOrigArgTys ) -import Var ( tyVarKind, TyVar, Id ) -import VarSet ( isEmptyVarSet, intersectVarSet, elemVarSet ) -import TysWiredIn ( unitTy ) -import BasicTypes ( RecFlag, StrictnessMark(..) ) -import Name ( Name ) -import OccName ( mkDataConWrapperOcc, mkDataConWorkerOcc, - mkClassTyConOcc, mkClassDataConOcc, - mkSuperDictSelOcc, mkNewTyCoOcc, - mkInstTyCoOcc ) -import MkId ( mkDataConIds, mkRecordSelId, mkDictSelId ) -import Class ( mkClass, Class( classTyCon), FunDep, DefMeth(..) ) -import TyCon ( mkSynTyCon, mkAlgTyCon, visibleDataCons, - tyConStupidTheta, tyConDataCons, isNewTyCon, - mkClassTyCon, TyCon( tyConTyVars ), - isRecursiveTyCon, AlgTyConRhs(..), - SynTyConRhs(..), newTyConRhs, AlgTyConParent(..) ) -import Type ( mkArrowKinds, liftedTypeKind, typeKind, - tyVarsOfType, tyVarsOfTypes, tyVarsOfPred, - splitTyConApp_maybe, splitAppTy_maybe, - getTyVar_maybe, - mkPredTys, mkTyVarTys, ThetaType, Type, - TyThing(..), - substTyWith, zipTopTvSubst, substTheta ) -import Coercion ( mkNewTypeCoercion, mkDataInstCoercion ) +import DataCon +import Var +import VarSet +import TysWiredIn +import BasicTypes +import Name +import OccName +import MkId +import Class +import TyCon +import Type +import Coercion import Outputable -import List ( nub ) +import Data.List \end{code} diff --git a/compiler/iface/IfaceEnv.lhs b/compiler/iface/IfaceEnv.lhs index fe0b0cd..3c3a34d 100644 --- a/compiler/iface/IfaceEnv.lhs +++ b/compiler/iface/IfaceEnv.lhs @@ -1,4 +1,4 @@ -(c) The University of Glasgow 2002 +(c) The University of Glasgow 2002-2006 \begin{code} module IfaceEnv ( @@ -19,29 +19,21 @@ module IfaceEnv ( #include "HsVersions.h" import TcRnMonad -import TysWiredIn ( tupleTyCon, tupleCon ) -import HscTypes ( NameCache(..), HscEnv(..), GenAvailInfo(..), - IfaceExport, OrigNameCache, AvailInfo ) -import Type ( mkOpenTvSubst, substTy ) -import TyCon ( TyCon, tyConName ) -import DataCon ( dataConWorkId, dataConName ) -import Var ( TyVar, Id, varName ) -import Name ( Name, nameUnique, nameModule, - nameOccName, nameSrcLoc, getOccName, - isWiredInName, mkIPName, - mkExternalName, mkInternalName ) -import NameSet ( NameSet, emptyNameSet, addListToNameSet ) -import OccName ( OccName, isTupleOcc_maybe, tcName, dataName, occNameFS, - lookupOccEnv, unitOccEnv, extendOccEnv ) -import PrelNames ( gHC_PRIM, dATA_TUP ) -import Module ( Module, emptyModuleEnv, ModuleName, modulePackageId, - lookupModuleEnv, extendModuleEnv_C, mkModule ) -import UniqFM ( lookupUFM, addListToUFM ) -import FastString ( FastString ) -import UniqSupply ( UniqSupply, splitUniqSupply, uniqFromSupply, uniqsFromSupply ) -import FiniteMap ( emptyFM, lookupFM, addToFM ) -import BasicTypes ( IPName(..), mapIPName ) -import SrcLoc ( SrcLoc, noSrcLoc ) +import TysWiredIn +import HscTypes +import TyCon +import DataCon +import Var +import Name +import OccName +import PrelNames +import Module +import UniqFM +import FastString +import UniqSupply +import FiniteMap +import BasicTypes +import SrcLoc import Outputable \end{code} @@ -205,7 +197,7 @@ lookupOrigNameCache nc mod occ mk_tup_name (ns, boxity, arity) | ns == tcName = tyConName (tupleTyCon boxity arity) | ns == dataName = dataConName (tupleCon boxity arity) - | otherwise = varName (dataConWorkId (tupleCon boxity arity)) + | otherwise = Var.varName (dataConWorkId (tupleCon boxity arity)) lookupOrigNameCache nc mod occ -- The normal case = case lookupModuleEnv nc mod of @@ -297,12 +289,6 @@ lookupIfaceTop :: OccName -> IfL Name lookupIfaceTop occ = do { env <- getLclEnv; lookupOrig (if_mod env) occ } -lookupHomePackage :: ModuleName -> OccName -> IfL Name -lookupHomePackage mod_name occ - = do { env <- getLclEnv; - ; let this_pkg = modulePackageId (if_mod env) - ; lookupOrig (mkModule this_pkg mod_name) occ } - newIfaceName :: OccName -> IfL Name newIfaceName occ = do { uniq <- newUnique diff --git a/compiler/iface/IfaceSyn.lhs b/compiler/iface/IfaceSyn.lhs index a842608..4f37ca0 100644 --- a/compiler/iface/IfaceSyn.lhs +++ b/compiler/iface/IfaceSyn.lhs @@ -1,14 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % -%************************************************************************ -%* * -\section[HsCore]{Core-syntax unfoldings in Haskell interface files} -%* * -%************************************************************************ - -We could either use this, or parameterise @GenCoreExpr@ on @Types@ and -@TyVars@ as well. Currently trying the former... MEGA SIGH. \begin{code} module IfaceSyn ( @@ -35,25 +28,22 @@ module IfaceSyn ( import CoreSyn import IfaceType -import NewDemand ( StrictSig, pprIfaceStrictSig ) -import Class ( FunDep, DefMeth, pprFundeps ) -import OccName -import UniqFM ( UniqFM, emptyUFM, addToUFM, lookupUFM ) -import Unique ( mkBuiltinUnique ) +import NewDemand +import Class +import UniqFM +import Unique import NameSet -import Name ( Name, NamedThing(..), isExternalName, - mkInternalName ) -import CostCentre ( CostCentre, pprCostCentreCore ) -import Literal ( Literal ) -import ForeignCall ( ForeignCall ) -import SrcLoc ( noSrcLoc ) +import Name +import CostCentre +import Literal +import ForeignCall +import SrcLoc import BasicTypes import Outputable import FastString -import Maybes ( catMaybes ) -import Data.List ( nub ) -import Data.Maybe ( isJust ) +import Data.List +import Data.Maybe infixl 3 &&& infix 4 `eqIfExt`, `eqIfIdInfo`, `eqIfType` diff --git a/compiler/iface/IfaceType.lhs b/compiler/iface/IfaceType.lhs index 64d8892..8af258a 100644 --- a/compiler/iface/IfaceType.lhs +++ b/compiler/iface/IfaceType.lhs @@ -1,8 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % - This module defines interface types and binders +This module defines interface types and binders \begin{code} module IfaceType ( @@ -24,18 +25,14 @@ module IfaceType ( #include "HsVersions.h" -import TypeRep ( TyThing(..), Type(..), PredType(..), ThetaType, - unliftedTypeKindTyConName, openTypeKindTyConName, - ubxTupleKindTyConName, argTypeKindTyConName, - liftedTypeKindTyConName ) -import TyCon ( TyCon, isTupleTyCon, tyConArity, tupleTyConBoxity, tyConName ) -import Var ( isId, tyVarKind, idType ) -import TysWiredIn ( listTyConName, parrTyConName, tupleTyCon, intTyConName, charTyConName, boolTyConName ) -import OccName ( OccName, parenSymOcc, occNameFS ) -import Name ( Name, getName, getOccName, nameModule, nameOccName, - wiredInNameTyThing_maybe ) -import Module ( Module, ModuleName ) -import BasicTypes ( IPName(..), Arity, Version, mapIPName, tupleParens, Boxity ) +import TypeRep +import TyCon +import Var +import TysWiredIn +import OccName +import Name +import Module +import BasicTypes import Outputable import FastString \end{code} diff --git a/compiler/iface/LoadIface.lhs b/compiler/iface/LoadIface.lhs index 5b19c89..4ef589d 100644 --- a/compiler/iface/LoadIface.lhs +++ b/compiler/iface/LoadIface.lhs @@ -1,7 +1,9 @@ - +% +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section{Dealing with interface files} + +Loading interface files \begin{code} module LoadIface ( @@ -19,53 +21,39 @@ module LoadIface ( import {-# SOURCE #-} TcIface( tcIfaceDecl, tcIfaceRules, tcIfaceInst, tcIfaceFamInst ) -import DynFlags ( DynFlags(..), DynFlag( Opt_IgnoreInterfacePragmas ) ) +import DynFlags import IfaceSyn -import IfaceEnv ( newGlobalBinder ) -import HscTypes ( ModIface(..), TyThing, IfaceExport, Usage(..), - Deprecs(..), Dependencies(..), - emptyModIface, EpsStats(..), GenAvailInfo(..), - addEpsInStats, ExternalPackageState(..), - PackageTypeEnv, emptyTypeEnv, HscEnv(..), - lookupIfaceByModule, emptyPackageIfaceTable, - IsBootInterface, mkIfaceFixCache, - implicitTyThings - ) - -import BasicTypes ( Version, initialVersion, - Fixity(..), FixityDirection(..), isMarkedStrict ) +import IfaceEnv +import HscTypes + +import BasicTypes hiding (SuccessFlag(..)) import TcRnMonad -import Type ( TyThing(..) ) - -import PrelNames ( gHC_PRIM ) -import PrelInfo ( ghcPrimExports ) -import PrelRules ( builtinRules ) -import Rules ( extendRuleBaseList, mkRuleBase ) -import InstEnv ( emptyInstEnv, extendInstEnvList ) -import FamInstEnv ( emptyFamInstEnv, extendFamInstEnvList ) -import Name ( Name {-instance NamedThing-}, getOccName, - nameModule, nameIsLocalOrFrom, isWiredInName ) +import Type + +import PrelNames +import PrelInfo +import PrelRules +import Rules +import InstEnv +import FamInstEnv +import Name import NameEnv -import MkId ( seqId ) +import MkId import Module -import OccName ( OccName, mkOccEnv, lookupOccEnv, mkClassTyConOcc, - mkClassDataConOcc, mkSuperDictSelOcc, - mkDataConWrapperOcc, mkDataConWorkerOcc, - mkNewTyCoOcc, mkInstTyCoOcc ) -import SrcLoc ( importedSrcLoc ) -import Maybes ( MaybeErr(..) ) -import ErrUtils ( Message ) -import Finder ( findImportedModule, findExactModule, - FindResult(..), cannotFindInterface ) +import OccName +import SrcLoc +import Maybes +import ErrUtils +import Finder import UniqFM -import StaticFlags ( opt_HiVersion ) +import StaticFlags import Outputable -import BinIface ( readBinIface, v_IgnoreHiWay ) -import Binary -import Panic ( ghcError, showException, GhcException(..) ) -import List ( nub ) -import Maybe ( isJust ) -import DATA_IOREF ( writeIORef ) +import BinIface +import Panic + +import Data.List +import Data.Maybe +import Data.IORef \end{code} @@ -342,9 +330,6 @@ loadDecl ignore_prags mod (_version, decl) (importedSrcLoc (showSDoc (ppr (moduleName mod)))) -- ToDo: qualify with the package name if necessary - ifFamily (IfaceData {ifFamInst = Just (famTyCon, _)}) = Just famTyCon - ifFamily _ = Nothing - doc = ptext SLIT("Declaration for") <+> ppr (ifName decl) bumpDeclStats :: Name -> IfL () -- Record that one more declaration has actually been used diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index e99e8bf..d9c993a 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 % @@ -175,80 +176,46 @@ compiled with -O. I think this is the case.] \begin{code} #include "HsVersions.h" -import IfaceSyn -- All of it +import IfaceSyn import IfaceType -import LoadIface ( readIface, loadInterface, pprModIface ) -import Id ( Id, idName, idType, idInfo, idArity, isDataConWorkId_maybe, isFCallId_maybe ) -import IdInfo ( IdInfo, CafInfo(..), WorkerInfo(..), - arityInfo, cafInfo, newStrictnessInfo, - workerInfo, unfoldingInfo, inlinePragInfo ) -import NewDemand ( isTopSig ) +import LoadIface +import Id +import IdInfo +import NewDemand import CoreSyn -import Class ( classExtraBigSig, classTyCon ) -import TyCon ( TyCon, AlgTyConRhs(..), SynTyConRhs(..), - isRecursiveTyCon, isForeignTyCon, - isSynTyCon, isAlgTyCon, isPrimTyCon, isFunTyCon, - isTupleTyCon, tupleTyConBoxity, tyConStupidTheta, - tyConHasGenerics, synTyConRhs, isGadtSyntaxTyCon, - tyConArity, tyConTyVars, algTyConRhs, tyConExtName, - tyConFamInst_maybe ) -import DataCon ( dataConName, dataConFieldLabels, dataConStrictMarks, - dataConTyCon, dataConIsInfix, dataConUnivTyVars, - dataConExTyVars, dataConEqSpec, dataConTheta, - dataConOrigArgTys ) -import Type ( TyThing(..), splitForAllTys, funResultTy ) -import TcType ( deNoteType ) -import TysPrim ( alphaTyVars ) -import InstEnv ( Instance(..) ) -import FamInstEnv ( FamInst(..) ) +import Class +import TyCon +import DataCon +import Type +import TcType +import TysPrim +import InstEnv +import FamInstEnv import TcRnMonad -import HscTypes ( ModIface(..), ModDetails(..), - ModGuts(..), HscEnv(..), hscEPS, Dependencies(..), - FixItem(..), - ModSummary(..), msHiFilePath, - mkIfaceDepCache, mkIfaceFixCache, mkIfaceVerCache, - typeEnvElts, - GenAvailInfo(..), availName, AvailInfo, - ExternalPackageState(..), - Usage(..), IsBootInterface, - Deprecs(..), IfaceDeprecs, Deprecations, - lookupIfaceByModule, isImplicitTyThing - ) - - -import DynFlags ( GhcMode(..), DynFlags(..), DynFlag(..), dopt ) -import Name ( Name, nameModule, nameModule_maybe, nameOccName, - isExternalName, isInternalName, isWiredInName, - NamedThing(..) ) +import HscTypes + +import DynFlags +import Name import NameEnv import NameSet -import OccName ( OccName, OccEnv, mkOccEnv, lookupOccEnv, emptyOccEnv, - extendOccEnv_C, - OccSet, emptyOccSet, elemOccSet, occSetElts, - extendOccSet, extendOccSetList, mkOccSet, - isEmptyOccSet, intersectOccSet, intersectsOccSet, - unionOccSets, unitOccSet, - occNameFS, isTcOcc ) +import OccName import Module -import BinIface ( readBinIface, writeBinIface, v_IgnoreHiWay ) -import Unique ( Unique, Uniquable(..) ) -import ErrUtils ( dumpIfSet_dyn, showPass ) -import Digraph ( stronglyConnComp, SCC(..) ) -import SrcLoc ( SrcSpan ) -import PackageConfig ( PackageId ) +import BinIface +import Unique +import ErrUtils +import Digraph +import SrcLoc +import PackageConfig hiding ( Version ) import Outputable import BasicTypes hiding ( SuccessFlag(..) ) import UniqFM import Util hiding ( eqListBy ) import FiniteMap import FastString +import Maybes -import Data.List ( partition ) -import DATA_IOREF ( writeIORef ) -import Monad ( when ) -import List ( insert ) -import Maybes ( orElse, mapCatMaybes, isNothing, isJust, - expectJust, catMaybes, MaybeErr(..) ) +import Control.Monad +import Data.List \end{code} diff --git a/compiler/iface/TcIface.lhs b/compiler/iface/TcIface.lhs index c16846e..53a9a59 100644 --- a/compiler/iface/TcIface.lhs +++ b/compiler/iface/TcIface.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcIfaceSig]{Type checking of type signatures in interface files} + +Type checking of type signatures in interface files \begin{code} module TcIface ( @@ -13,63 +15,45 @@ module TcIface ( #include "HsVersions.h" import IfaceSyn -import LoadIface ( loadInterface, loadWiredInHomeIface, findAndReadIface, loadDecls ) -import IfaceEnv ( lookupIfaceTop, newGlobalBinder, - extendIfaceIdEnv, extendIfaceTyVarEnv, newIPName, - tcIfaceTyVar, tcIfaceLclId, - newIfaceName, newIfaceNames, ifaceExportNames ) -import BuildTyCl ( buildSynTyCon, buildAlgTyCon, buildDataCon, - buildClass, - mkAbstractTyConRhs, mkOpenDataTyConRhs, - mkOpenNewTyConRhs, mkDataTyConRhs, mkNewTyConRhs ) +import LoadIface +import IfaceEnv +import BuildTyCl import TcRnMonad -import Type ( liftedTypeKind, splitTyConApp, mkTyConApp, - liftedTypeKindTyCon, unliftedTypeKindTyCon, - openTypeKindTyCon, argTypeKindTyCon, - ubxTupleKindTyCon, ThetaType ) -import TypeRep ( Type(..), PredType(..) ) -import TyCon ( TyCon, tyConName, SynTyConRhs(..), setTyConArgPoss ) -import HscTypes ( ExternalPackageState(..), - TyThing(..), tyThingClass, tyThingTyCon, - ModIface(..), ModDetails(..), HomeModInfo(..), - emptyModDetails, lookupTypeEnv, lookupType, - typeEnvIds ) -import InstEnv ( Instance(..), mkImportedInstance ) -import FamInstEnv ( FamInst(..), mkImportedFamInst ) +import Type +import TypeRep +import HscTypes +import InstEnv +import FamInstEnv import CoreSyn -import CoreUtils ( exprType, dataConRepFSInstPat ) +import CoreUtils import CoreUnfold -import CoreLint ( lintUnfolding ) -import WorkWrap ( mkWrapper ) -import Id ( Id, mkVanillaGlobal, mkLocalId ) -import MkId ( mkFCallId ) -import IdInfo ( IdInfo, CafInfo(..), WorkerInfo(..), - setUnfoldingInfoLazily, setAllStrictnessInfo, setWorkerInfo, - setArityInfo, setInlinePragInfo, setCafInfo, - vanillaIdInfo, newStrictnessInfo ) -import Class ( Class ) -import TyCon ( tyConDataCons, isTupleTyCon, mkForeignTyCon ) -import DataCon ( DataCon, dataConWorkId ) -import TysWiredIn ( tupleCon, tupleTyCon, listTyCon, intTyCon, boolTyCon, charTyCon, parrTyCon ) -import Var ( TyVar, mkTyVar ) -import Name ( Name, nameModule, nameIsLocalOrFrom, isWiredInName, - nameOccName, wiredInNameTyThing_maybe ) +import CoreLint +import WorkWrap +import Id +import MkId +import IdInfo +import Class +import TyCon +import DataCon +import TysWiredIn +import Var ( TyVar ) +import qualified Var +import Name import NameEnv -import OccName ( OccName, mkVarOccFS, mkTyVarOcc, occNameSpace, - pprNameSpace, occNameFS ) -import Module ( Module, moduleName ) -import UniqFM ( lookupUFM ) -import UniqSupply ( initUs_, uniqsFromSupply ) +import OccName +import Module +import UniqFM +import UniqSupply import Outputable -import ErrUtils ( Message ) -import Maybes ( MaybeErr(..) ) -import SrcLoc ( noSrcLoc ) -import Util ( zipWithEqual ) -import DynFlags ( DynFlag(..), isOneShot ) -import Control.Monad ( unless ) - -import List ( elemIndex) -import Maybe ( catMaybes ) +import ErrUtils +import Maybes +import SrcLoc +import Util +import DynFlags +import Control.Monad + +import Data.List +import Data.Maybe \end{code} This module takes @@ -1020,14 +1004,14 @@ bindIfaceTyVar (occ,kind) thing_inside bindIfaceTyVars :: [IfaceTvBndr] -> ([TyVar] -> IfL a) -> IfL a bindIfaceTyVars bndrs thing_inside = do { names <- newIfaceNames (map mkTyVarOcc occs) - ; tyvars <- zipWithM mk_iface_tyvar names kinds + ; tyvars <- TcRnMonad.zipWithM mk_iface_tyvar names kinds ; extendIfaceTyVarEnv tyvars (thing_inside tyvars) } where (occs,kinds) = unzip bndrs mk_iface_tyvar :: Name -> IfaceKind -> IfL TyVar mk_iface_tyvar name ifKind = do { kind <- tcIfaceType ifKind - ; return (mkTyVar name kind) + ; return (Var.mkTyVar name kind) } \end{code} diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs index 0563f34..31995f0 100644 --- a/compiler/main/HscMain.lhs +++ b/compiler/main/HscMain.lhs @@ -90,9 +90,10 @@ import ParserCoreUtils import FastString import UniqFM ( emptyUFM ) import Bag ( unitBag ) -import Monad ( unless ) -import IO -import DATA_IOREF ( newIORef, readIORef ) + +import Control.Monad +import System.IO +import Data.IORef \end{code} diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index d3c5f7f..7e30d77 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -103,10 +103,11 @@ import UniqFM ( lookupUFM, eltsUFM, emptyUFM ) import UniqSupply ( UniqSupply ) import FastString ( FastString ) -import DATA_IOREF ( IORef, readIORef ) import StringBuffer ( StringBuffer ) import Maybes ( catMaybes, seqMaybe ) -import Time ( ClockTime ) + +import System.Time ( ClockTime ) +import Data.IORef ( IORef, readIORef ) \end{code} diff --git a/compiler/main/TidyPgm.lhs b/compiler/main/TidyPgm.lhs index dc0ea7e..b95d4d3 100644 --- a/compiler/main/TidyPgm.lhs +++ b/compiler/main/TidyPgm.lhs @@ -48,11 +48,12 @@ import Maybes ( orElse, mapCatMaybes ) import ErrUtils ( showPass, dumpIfSet_core ) import PackageConfig ( PackageId ) import UniqSupply ( splitUniqSupply, uniqFromSupply ) -import List ( partition ) -import Maybe ( isJust ) import Outputable -import DATA_IOREF ( IORef, readIORef, writeIORef ) import FastTypes hiding ( fastOr ) + +import Data.List ( partition ) +import Data.Maybe ( isJust ) +import Data.IORef ( IORef, readIORef, writeIORef ) \end{code} diff --git a/compiler/ndpFlatten/Flattening.hs b/compiler/ndpFlatten/Flattening.hs index c339c76..18fc319 100644 --- a/compiler/ndpFlatten/Flattening.hs +++ b/compiler/ndpFlatten/Flattening.hs @@ -92,7 +92,7 @@ import FastString -- FIXME: fro debugging - remove this -import TRACE (trace) +import Debug.Trace (trace) -- standard import Monad (liftM, foldM) diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs index f7a3198..1a0a39e 100644 --- a/compiler/prelude/PrelRules.lhs +++ b/compiler/prelude/PrelRules.lhs @@ -45,11 +45,11 @@ import Outputable import FastString import StaticFlags ( opt_SimplExcessPrecision ) -import DATA_BITS ( Bits(..) ) +import Data.Bits ( Bits(..) ) #if __GLASGOW_HASKELL__ >= 500 -import DATA_WORD ( Word ) +import Data.Word ( Word ) #else -import DATA_WORD ( Word64 ) +import Data.Word ( Word64 ) #endif \end{code} diff --git a/compiler/prelude/TysPrim.lhs b/compiler/prelude/TysPrim.lhs index 7a31683..1ec7721 100644 --- a/compiler/prelude/TysPrim.lhs +++ b/compiler/prelude/TysPrim.lhs @@ -7,7 +7,7 @@ module TysPrim( alphaTyVars, betaTyVars, alphaTyVar, betaTyVar, gammaTyVar, deltaTyVar, alphaTy, betaTy, gammaTy, deltaTy, - openAlphaTy, openAlphaTyVar, openAlphaTyVars, + openAlphaTy, openBetaTy, openAlphaTyVar, openBetaTyVar, openAlphaTyVars, primTyCons, @@ -167,9 +167,10 @@ alphaTys = mkTyVarTys alphaTyVars -- to a lifted or unlifted type variable. It's used for the -- result type for "error", so that we can have (error Int# "Help") openAlphaTyVars :: [TyVar] -openAlphaTyVars@(openAlphaTyVar:_) = tyVarList openTypeKind +openAlphaTyVars@(openAlphaTyVar:openBetaTyVar:_) = tyVarList openTypeKind openAlphaTy = mkTyVarTy openAlphaTyVar +openBetaTy = mkTyVarTy openBetaTyVar \end{code} diff --git a/compiler/simplCore/SimplMonad.lhs b/compiler/simplCore/SimplMonad.lhs index bc09e11..5b6ac40 100644 --- a/compiler/simplCore/SimplMonad.lhs +++ b/compiler/simplCore/SimplMonad.lhs @@ -41,7 +41,7 @@ import FastString ( FastString ) import Outputable import FastTypes -import GLAEXTS ( indexArray# ) +import GHC.Exts ( indexArray# ) #if __GLASGOW_HASKELL__ < 503 import PrelArr ( Array(..) ) diff --git a/compiler/typecheck/FamInst.lhs b/compiler/typecheck/FamInst.lhs index e38a3b1..3f22633 100644 --- a/compiler/typecheck/FamInst.lhs +++ b/compiler/typecheck/FamInst.lhs @@ -1,4 +1,4 @@ -\section[FamInst]{The @FamInst@ type: family instance heads} +The @FamInst@ type: family instance heads \begin{code} module FamInst ( @@ -7,17 +7,13 @@ module FamInst ( #include "HsVersions.h" -import HscTypes ( ExternalPackageState(..) ) -import FamInstEnv ( FamInstEnv, FamInst(..), famInstTyCon, extendFamInstEnv, - pprFamInst, pprFamInsts ) -import TcMType ( tcInstSkolType ) -import TcType ( SkolemInfo(..), tcSplitTyConApp ) -import TcRnMonad ( TcM, TcGblEnv(..), setGblEnv, getGblEnv, foldlM, - setSrcSpan, addErr, getEps ) -import TyCon ( tyConFamInst_maybe ) -import Type ( mkTyConApp ) -import Name ( getSrcLoc ) -import SrcLoc ( mkSrcSpan ) +import HscTypes +import FamInstEnv +import TcMType +import TcType +import TcRnMonad +import TyCon +import Type import Outputable \end{code} @@ -81,6 +77,7 @@ addLocalFamInst home_fie famInst -- OK, now extend the envt ; return (extendFamInstEnv home_fie famInst) } +{- UNUSED??? --SDM overlapErr famInst dupFamInst = addFamInstLoc famInst $ addErr (hang (ptext SLIT("Overlapping family instance declarations:")) @@ -90,4 +87,5 @@ addFamInstLoc famInst thing_inside = setSrcSpan (mkSrcSpan loc loc) thing_inside where loc = getSrcLoc famInst +-} \end{code} diff --git a/compiler/typecheck/Inst.lhs b/compiler/typecheck/Inst.lhs index 3bfde1c..ed5528c 100644 --- a/compiler/typecheck/Inst.lhs +++ b/compiler/typecheck/Inst.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[Inst]{The @Inst@ type: dictionaries or method instances} + +The @Inst@ type: dictionaries or method instances \begin{code} module Inst ( @@ -42,56 +44,35 @@ module Inst ( import {-# SOURCE #-} TcExpr( tcPolyExpr ) import {-# SOURCE #-} TcUnify( unifyType ) -import HsSyn ( HsLit(..), HsOverLit(..), HsExpr(..), LHsExpr, mkHsApp, - HsWrapper(..), (<.>), mkWpTyApps, idHsWrapper, - nlHsLit, nlHsVar ) -import TcHsSyn ( zonkId ) +import HsSyn +import TcHsSyn import TcRnMonad -import TcEnv ( tcLookupId, checkWellStaged, topIdLvl, tcMetaTy ) -import InstEnv ( DFunId, InstEnv, Instance(..), OverlapFlag(..), - lookupInstEnv, extendInstEnv, pprInstances, - instanceHead, instanceDFunId, setInstanceDFunId ) -import FunDeps ( checkFunDeps ) -import TcMType ( zonkTcType, zonkTcTypes, zonkTcPredType, zonkTcThetaType, - tcInstTyVar, tcInstSkolType - ) -import TcType ( Type, TcType, TcThetaType, TcTyVarSet, TcPredType, - BoxyRhoType, - PredType(..), SkolemInfo(..), typeKind, mkSigmaTy, - tcSplitForAllTys, applyTys, - tcSplitPhiTy, tcSplitDFunHead, - isIntTy,isFloatTy, isIntegerTy, isDoubleTy, - mkPredTy, mkTyVarTys, - tyVarsOfType, tyVarsOfTypes, tyVarsOfPred, tidyPred, - isClassPred, isTyVarClassPred, - getClassPredTys, mkPredName, - isInheritablePred, isIPPred, - tidyType, tidyTypes, tidyFreeTyVars, tcSplitSigmaTy, - pprPred, pprParendType, pprTheta - ) -import Type ( TvSubst, substTy, substTyVar, substTyWith, - notElemTvSubst, extendTvSubstList ) -import Unify ( tcMatchTys ) -import Module ( modulePackageId ) -import {- Kind parts of -} Type ( isSubKind ) -import Coercion ( isEqPred ) -import HscTypes ( ExternalPackageState(..), HscEnv(..) ) -import CoreFVs ( idFreeTyVars ) -import DataCon ( dataConWrapId ) -import Id ( Id, idName, idType, mkUserLocal, mkLocalId, isId ) -import Name ( Name, mkMethodOcc, getOccName, getSrcLoc, nameModule, - isInternalName, setNameUnique ) -import NameSet ( addOneToNameSet ) -import Literal ( inIntRange ) -import Var ( Var, TyVar, tyVarKind, setIdType, isId, mkTyVar ) -import VarEnv ( TidyEnv, emptyTidyEnv ) -import VarSet ( elemVarSet, emptyVarSet, unionVarSet, mkVarSet ) -import TysWiredIn ( floatDataCon, doubleDataCon ) -import PrelNames ( integerTyConName, fromIntegerName, fromRationalName, rationalTyConName ) -import BasicTypes( IPName(..), mapIPName, ipNameName ) -import SrcLoc ( mkSrcSpan, noLoc, unLoc, Located(..) ) -import DynFlags ( DynFlag(..), DynFlags(..), dopt ) -import Maybes ( isJust ) +import TcEnv +import InstEnv +import FunDeps +import TcMType +import TcType +import Type +import Unify +import Module +import Coercion +import HscTypes +import CoreFVs +import DataCon +import Id +import Name +import NameSet +import Literal +import Var ( Var, TyVar ) +import qualified Var +import VarEnv +import VarSet +import TysWiredIn +import PrelNames +import BasicTypes +import SrcLoc +import DynFlags +import Maybes import Outputable \end{code} @@ -111,7 +92,7 @@ instToVar :: Inst -> Var instToVar (LitInst nm _ ty _) = mkLocalId nm ty instToVar (Method id _ _ _ _) = id instToVar (Dict nm pred _) - | isEqPred pred = mkTyVar nm (mkPredTy pred) + | isEqPred pred = Var.mkTyVar nm (mkPredTy pred) | otherwise = mkLocalId nm (mkPredTy pred) instLoc (Dict _ _ loc) = loc @@ -337,12 +318,12 @@ checkKind :: TyVar -> TcType -> TcM () checkKind tv ty = do { let ty1 = ty -- ty1 <- zonkTcType ty - ; if typeKind ty1 `isSubKind` tyVarKind tv + ; if typeKind ty1 `isSubKind` Var.tyVarKind tv then return () else pprPanic "checkKind: adding kind constraint" - (vcat [ppr tv <+> ppr (tyVarKind tv), + (vcat [ppr tv <+> ppr (Var.tyVarKind tv), ppr ty <+> ppr ty1 <+> ppr (typeKind ty1)]) } -- do { tv1 <- tcInstTyVar tv diff --git a/compiler/typecheck/TcArrows.lhs b/compiler/typecheck/TcArrows.lhs index b53b5ea..57cb48c 100644 --- a/compiler/typecheck/TcArrows.lhs +++ b/compiler/typecheck/TcArrows.lhs @@ -1,7 +1,8 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section{Typecheck arrow notation} +Typecheck arrow notation \begin{code} module TcArrows ( tcProc ) where @@ -11,32 +12,28 @@ module TcArrows ( tcProc ) where import {-# SOURCE #-} TcExpr( tcMonoExpr, tcInferRho ) import HsSyn -import TcHsSyn ( mkHsDictLet ) - -import TcMatches ( matchCtxt, tcStmts, tcMDoStmt, tcGuardStmt, - TcMatchCtxt(..), tcMatchesCase ) - -import TcType ( TcType, TcTauType, BoxyRhoType, mkFunTys, mkTyConApp, - mkTyVarTy, mkAppTys, tcSplitTyConApp_maybe, tcEqType, - SkolemInfo(..) ) -import TcMType ( newFlexiTyVarTy, tcInstSkolTyVars, zonkTcType ) -import TcBinds ( tcLocalBinds ) -import TcSimplify ( tcSimplifyCheck ) -import TcGadt ( Refinement, emptyRefinement, refineResType ) -import TcPat ( tcLamPat, tcLamPats ) -import TcUnify ( checkSigTyVarsWrt, boxySplitAppTy ) +import TcHsSyn + +import TcMatches + +import TcType +import TcMType +import TcBinds +import TcSimplify +import TcGadt +import TcPat +import TcUnify import TcRnMonad -import Inst ( tcSyntaxName ) -import Name ( Name ) -import TysWiredIn ( boolTy, pairTyCon ) +import Inst +import Name +import TysWiredIn import VarSet -import TysPrim ( alphaTyVar ) -import Type ( Kind, mkArrowKinds, liftedTypeKind, openTypeKind, tyVarsOfTypes ) +import TysPrim +import Type -import SrcLoc ( Located(..), noLoc, unLoc ) +import SrcLoc import Outputable -import Util ( lengthAtLeast ) - +import Util \end{code} %************************************************************************ diff --git a/compiler/typecheck/TcBinds.lhs b/compiler/typecheck/TcBinds.lhs index a3b17a6..9983267 100644 --- a/compiler/typecheck/TcBinds.lhs +++ b/compiler/typecheck/TcBinds.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[TcBinds]{TcBinds} @@ -15,56 +16,36 @@ module TcBinds ( tcLocalBinds, tcTopBinds, import {-# SOURCE #-} TcMatches ( tcGRHSsPat, tcMatchesFun ) import {-# SOURCE #-} TcExpr ( tcMonoExpr ) -import DynFlags ( dopt, DynFlags, - DynFlag(Opt_MonomorphismRestriction, Opt_MonoPatBinds, Opt_GlasgowExts) ) -import HsSyn ( HsExpr(..), HsBind(..), LHsBinds, LHsBind, Sig(..), - HsLocalBinds(..), HsValBinds(..), HsIPBinds(..), - LSig, Match(..), IPBind(..), Prag(..), LHsType, - isVanillaLSig, sigName, placeHolderNames, isPragLSig, - LPat, GRHSs, MatchGroup(..), pprLHsBinds, mkHsWrap, hsExplicitTvs, - collectHsBindBinders, collectPatBinders, pprPatBind, isBangHsBind - ) -import TcHsSyn ( zonkId ) +import DynFlags +import HsSyn +import TcHsSyn import TcRnMonad -import Inst ( newDictBndrs, newIPDict, instToId ) -import TcEnv ( tcExtendIdEnv, tcExtendIdEnv2, tcExtendTyVarEnv2, - pprBinders, tcLookupId, - tcGetGlobalTyVars ) -import TcUnify ( tcInfer, tcSubExp, unifyTheta, - bleatEscapedTvs, sigCtxt ) -import TcSimplify ( tcSimplifyInfer, tcSimplifyInferCheck, - tcSimplifyRestricted, tcSimplifyIPs ) -import TcHsType ( tcHsSigType, UserTypeCtxt(..) ) -import TcPat ( tcLetPat ) -import TcSimplify ( bindInstsOfLocalFuns ) -import TcMType ( newFlexiTyVarTy, zonkQuantifiedTyVar, zonkSigTyVar, - tcInstSigTyVars, tcInstSkolTyVars, tcInstType, - zonkTcType, zonkTcTypes, zonkTcTyVar ) -import TcType ( TcType, TcTyVar, TcThetaType, - SkolemInfo(SigSkol), UserTypeCtxt(FunSigCtxt), - TcTauType, TcSigmaType, isUnboxedTupleType, - mkTyVarTy, mkForAllTys, mkFunTys, exactTyVarsOfType, - mkForAllTy, isUnLiftedType, tcGetTyVar, - mkTyVarTys, tidyOpenTyVar ) -import {- Kind parts of -} Type ( argTypeKind ) -import VarEnv ( TyVarEnv, emptyVarEnv, lookupVarEnv, extendVarEnv ) -import TysPrim ( alphaTyVar ) -import Id ( Id, mkLocalId, mkVanillaGlobal ) -import IdInfo ( vanillaIdInfo ) -import Var ( TyVar, idType, idName ) -import Name ( Name ) +import Inst +import TcEnv +import TcUnify +import TcSimplify +import TcHsType +import TcPat +import TcMType +import TcType +import {- Kind parts of -} Type +import VarEnv +import TysPrim +import Id +import IdInfo +import Var ( TyVar ) +import Name import NameSet import NameEnv import VarSet -import SrcLoc ( Located(..), unLoc, getLoc ) +import SrcLoc import Bag -import ErrUtils ( Message ) -import Digraph ( SCC(..), stronglyConnComp ) -import Maybes ( expectJust, isJust, isNothing, orElse ) -import Util ( singleton ) -import BasicTypes ( TopLevelFlag(..), isTopLevel, isNotTopLevel, - RecFlag(..), isNonRec, InlineSpec, defaultInlineSpec ) +import ErrUtils +import Digraph +import Maybes +import Util +import BasicTypes import Outputable \end{code} diff --git a/compiler/typecheck/TcClassDcl.lhs b/compiler/typecheck/TcClassDcl.lhs index 9d0fb13..30dfc7c 100644 --- a/compiler/typecheck/TcClassDcl.lhs +++ b/compiler/typecheck/TcClassDcl.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcClassDcl]{Typechecking class declarations} + +Typechecking class declarations \begin{code} module TcClassDcl ( tcClassSigs, tcClassDecl2, @@ -13,60 +15,47 @@ module TcClassDcl ( tcClassSigs, tcClassDecl2, #include "HsVersions.h" import HsSyn -import RnHsSyn ( maybeGenericMatch, extractHsTyVars ) -import RnExpr ( rnLExpr ) -import RnEnv ( lookupTopBndrRn, lookupImportedName ) -import Inst ( instToId, newDictBndr, newDictBndrs, newMethod, getOverlapFlag ) -import InstEnv ( mkLocalInstance ) -import TcEnv ( tcLookupLocatedClass, - tcExtendTyVarEnv, tcExtendIdEnv, - InstInfo(..), pprInstInfoDetails, - simpleInstInfoTyCon, simpleInstInfoTy, - InstBindings(..), newDFunName - ) -import TcBinds ( TcPragFun, tcMonoBinds, tcPrags, mkPragFun, TcSigInfo(..), - TcSigFun, mkTcSigFun ) -import TcHsType ( tcHsKindedType, tcHsSigType ) -import TcSimplify ( tcSimplifyCheck ) -import TcUnify ( checkSigTyVars, sigCtxt ) -import TcMType ( tcSkolSigTyVars ) -import TcType ( Type, SkolemInfo(ClsSkol, InstSkol), UserTypeCtxt( GenPatCtxt ), - TcType, TcThetaType, TcTyVar, mkTyVarTys, - mkClassPred, tcSplitSigmaTy, tcSplitFunTys, - tcIsTyVarTy, tcSplitTyConApp_maybe, tcSplitForAllTys, tcSplitPhiTy, - getClassPredTys_maybe, mkPhiTy, mkTyVarTy - ) +import RnHsSyn +import RnExpr +import RnEnv +import Inst +import InstEnv +import TcEnv +import TcBinds +import TcHsType +import TcSimplify +import TcUnify +import TcMType +import TcType import TcRnMonad -import Generics ( mkGenericRhs, validGenericInstanceType ) -import PrelInfo ( nO_METHOD_BINDING_ERROR_ID ) -import Class ( classTyVars, classBigSig, - Class, ClassOpItem, DefMeth (..) ) -import TyCon ( TyCon, tyConName, tyConHasGenerics ) -import Type ( substTyWith ) -import MkId ( mkDefaultMethodId, mkDictFunId ) -import Id ( Id, idType, idName, mkUserLocal ) -import Name ( Name, NamedThing(..) ) -import NameEnv ( NameEnv, lookupNameEnv, mkNameEnv ) -import NameSet ( nameSetToList ) -import OccName ( reportIfUnused, mkDefaultMethodOcc ) -import RdrName ( RdrName, mkDerivedRdrName ) +import Generics +import PrelInfo +import Class +import TyCon +import Type +import MkId +import Id +import Name +import NameEnv +import NameSet +import OccName +import RdrName import Outputable -import PrelNames ( genericTyConNames ) +import PrelNames import DynFlags -import ErrUtils ( dumpIfSet_dyn ) -import Util ( count, lengthIs, isSingleton, lengthExceeds ) -import Unique ( Uniquable(..) ) -import ListSetOps ( equivClassesByUniq, minusList ) -import SrcLoc ( Located(..), srcSpanStart, unLoc, noLoc ) -import Maybes ( seqMaybe, isJust, mapCatMaybes ) -import List ( partition ) -import BasicTypes ( RecFlag(..), Boxity(..) ) +import ErrUtils +import Util +import Unique +import ListSetOps +import SrcLoc +import Maybes +import List +import BasicTypes import Bag import FastString \end{code} - Dictionary handling ~~~~~~~~~~~~~~~~~~~ Every class implicitly declares a new data type, corresponding to dictionaries diff --git a/compiler/typecheck/TcDefaults.lhs b/compiler/typecheck/TcDefaults.lhs index 6c9de36..0011215 100644 --- a/compiler/typecheck/TcDefaults.lhs +++ b/compiler/typecheck/TcDefaults.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1993-1998 % \section[TcDefaults]{Typechecking \tr{default} declarations} @@ -8,15 +9,15 @@ module TcDefaults ( tcDefaults ) where #include "HsVersions.h" -import HsSyn ( DefaultDecl(..), LDefaultDecl ) -import Name ( Name ) +import HsSyn +import Name import TcRnMonad -import TcEnv ( tcLookupClass ) -import TcHsType ( tcHsSigType, UserTypeCtxt( DefaultDeclCtxt ) ) -import TcSimplify ( tcSimplifyDefault ) -import TcType ( Type, mkClassPred, isTauTy ) -import PrelNames ( numClassName ) -import SrcLoc ( Located(..) ) +import TcEnv +import TcHsType +import TcSimplify +import TcType +import PrelNames +import SrcLoc import Outputable \end{code} diff --git a/compiler/typecheck/TcDeriv.lhs b/compiler/typecheck/TcDeriv.lhs index 776199f..68c5173 100644 --- a/compiler/typecheck/TcDeriv.lhs +++ b/compiler/typecheck/TcDeriv.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcDeriv]{Deriving} Handles @deriving@ clauses on @data@ declarations. @@ -11,49 +11,39 @@ module TcDeriv ( tcDeriving ) where #include "HsVersions.h" import HsSyn -import DynFlags ( DynFlag(..) ) +import DynFlags -import Generics ( mkTyConGenericBinds ) +import Generics import TcRnMonad -import TcMType ( checkValidInstance ) -import TcEnv ( newDFunName, pprInstInfoDetails, - InstInfo(..), InstBindings(..), simpleInstInfoClsTy, - tcLookupClass, tcLookupTyCon, tcLookupLocatedTyCon, tcExtendTyVarEnv - ) +import TcMType +import TcEnv import TcGenDeriv -- Deriv stuff -import InstEnv ( Instance, OverlapFlag, mkLocalInstance, instanceHead, extendInstEnvList ) -import Inst ( getOverlapFlag ) -import TcHsType ( tcHsDeriv ) -import TcSimplify ( tcSimplifyDeriv ) -import TypeRep ( PredType ) - -import RnBinds ( rnMethodBinds, rnTopBinds ) -import RnEnv ( bindLocalNames ) -import HscTypes ( FixityEnv ) - -import Class ( className, classArity, classKey, classTyVars, classSCTheta, Class ) -import Type ( zipOpenTvSubst, substTheta, pprThetaArrow, pprClassPred, mkTyVarTy ) -import ErrUtils ( dumpIfSet_dyn ) -import MkId ( mkDictFunId ) -import DataCon ( isNullarySrcDataCon, isVanillaDataCon, dataConInstOrigArgTys ) -import Maybes ( catMaybes ) -import RdrName ( RdrName ) -import Name ( Name, getSrcLoc ) -import NameSet ( duDefs ) -import Type ( splitKindFunTys ) -import TyCon ( tyConTyVars, tyConDataCons, tyConArity, tyConHasGenerics, - tyConStupidTheta, isProductTyCon, isDataTyCon, isNewTyCon, newTyConRhs, - isEnumerationTyCon, isRecursiveTyCon, TyCon - ) -import TcType ( TcType, ThetaType, mkTyVarTys, mkTyConApp, tcTyConAppTyCon, - isUnLiftedType, mkClassPred, tyVarsOfType, tyVarsOfTypes, - isSubArgTypeKind, tcEqTypes, tcSplitAppTys, mkAppTys ) -import Var ( TyVar, tyVarKind, varName ) -import VarSet ( mkVarSet, disjointVarSet ) +import InstEnv +import Inst +import TcHsType +import TcSimplify + +import RnBinds +import RnEnv +import HscTypes + +import Class +import Type +import ErrUtils +import MkId +import DataCon +import Maybes +import RdrName +import Name +import NameSet +import TyCon +import TcType +import Var +import VarSet import PrelNames -import SrcLoc ( SrcSpan, srcLocSpan, Located(..), unLoc ) -import Util ( zipWithEqual, sortLe, notNull ) -import ListSetOps ( removeDups, assocMaybe ) +import SrcLoc +import Util +import ListSetOps import Outputable import Bag \end{code} @@ -876,7 +866,7 @@ genInst spec -- It's a bit yukky that we return *renamed* InstInfo, but -- *non-renamed* auxiliary bindings ; (rn_meth_binds, _fvs) <- discardWarnings $ - bindLocalNames (map varName tyvars) $ + bindLocalNames (map Var.varName tyvars) $ rnMethodBinds clas_nm (\n -> []) [] meth_binds -- Build the InstInfo diff --git a/compiler/typecheck/TcEnv.lhs b/compiler/typecheck/TcEnv.lhs index 59d60eb..c638c04 100644 --- a/compiler/typecheck/TcEnv.lhs +++ b/compiler/typecheck/TcEnv.lhs @@ -1,3 +1,7 @@ +% +% (c) The University of Glasgow 2006 +% + \begin{code} module TcEnv( TyThing(..), TcTyThing(..), TcId, @@ -43,36 +47,29 @@ module TcEnv( #include "HsVersions.h" -import HsSyn ( LRuleDecl, LHsBinds, LSig, - LHsTyVarBndr, HsTyVarBndr(..), pprLHsBinds, - idHsWrapper, (<.>) ) -import TcIface ( tcImportDecl ) -import IfaceEnv ( newGlobalBinder ) +import HsSyn +import TcIface +import IfaceEnv import TcRnMonad -import TcMType ( zonkTcType, zonkTcTyVarsAndFV ) -import TcType ( Type, TcKind, TcTyVar, TcTyVarSet, TcType, PredType, - tyVarsOfType, tcTyVarsOfTypes, mkTyConApp, - getDFunTyKey, tcTyConAppTyCon, tcGetTyVar, mkTyVarTy, - tidyOpenType, isRefineableTy - ) -import TcGadt ( Refinement, refineType ) -import qualified Type ( getTyVar_maybe ) -import Id ( idName, isLocalId ) -import Var ( TyVar, Id, idType, tyVarName ) +import TcMType +import TcType +import TcGadt +import qualified Type +import Id +import Var import VarSet import VarEnv -import RdrName ( extendLocalRdrEnv ) -import InstEnv ( Instance, DFunId, instanceDFunId, instanceHead ) -import DataCon ( DataCon ) -import TyCon ( TyCon ) -import Class ( Class ) -import Name ( Name, NamedThing(..), getSrcLoc, nameModule_maybe, nameOccName ) -import PrelNames ( thFAKE ) +import RdrName +import InstEnv +import DataCon +import TyCon +import Class +import Name +import PrelNames import NameEnv -import OccName ( mkDFunOcc, occNameString, mkInstTyTcOcc ) -import HscTypes ( extendTypeEnvList, lookupType, TyThing(..), - ExternalPackageState(..) ) -import SrcLoc ( SrcLoc, Located(..) ) +import OccName +import HscTypes +import SrcLoc import Outputable \end{code} diff --git a/compiler/typecheck/TcRnMonad.lhs b/compiler/typecheck/TcRnMonad.lhs index 3272dea..e6d75e3 100644 --- a/compiler/typecheck/TcRnMonad.lhs +++ b/compiler/typecheck/TcRnMonad.lhs @@ -1,3 +1,7 @@ +% +% (c) The University of Glasgow 2006 +% + \begin{code} module TcRnMonad( module TcRnMonad, @@ -11,58 +15,48 @@ import TcRnTypes -- Re-export all import IOEnv -- Re-export all #if defined(GHCI) && defined(BREAKPOINT) -import TypeRep ( Type(..), liftedTypeKind ) -import Var ( mkTyVar, mkGlobalId ) -import IdInfo ( GlobalIdDetails(..), vanillaIdInfo ) -import OccName ( mkOccName, tvName ) -import SrcLoc ( noSrcLoc ) -import TysWiredIn ( intTy, stringTy, mkListTy, unitTy, boolTy ) -import PrelNames ( breakpointJumpName, breakpointCondJumpName ) -import NameEnv ( mkNameEnv ) -import TcEnv ( tcExtendIdEnv ) +import TypeRep +import Var +import IdInfo +import OccName +import SrcLoc +import TysWiredIn +import PrelNames +import NameEnv +import TcEnv #endif -import HsSyn ( emptyLHsBinds, HaddockModInfo(..) ) -import HscTypes ( HscEnv(..), ModGuts(..), ModIface(..), - TypeEnv, emptyTypeEnv, HscSource(..), isHsBoot, - ExternalPackageState(..), HomePackageTable, - Deprecs(..), FixityEnv, FixItem, - mkPrintUnqualified ) -import Module ( Module, moduleName ) -import RdrName ( GlobalRdrEnv, LocalRdrEnv, emptyLocalRdrEnv ) -import Name ( Name, mkInternalName, tidyNameOcc, nameOccName, getSrcLoc ) -import Type ( Type ) -import TcType ( TcType, tcIsTyVarTy, tcGetTyVar ) -import NameEnv ( extendNameEnvList, nameEnvElts ) -import InstEnv ( emptyInstEnv ) -import FamInstEnv ( emptyFamInstEnv ) - -import Var ( setTyVarName ) -import Id ( mkSysLocal ) -import VarSet ( emptyVarSet ) -import VarEnv ( TidyEnv, emptyTidyEnv, extendVarEnv ) -import ErrUtils ( Message, Messages, emptyMessages, errorsFound, - mkWarnMsg, printErrorsAndWarnings, - mkLocMessage, mkLongErrMsg ) -import SrcLoc ( mkGeneralSrcSpan, isGoodSrcSpan, SrcSpan, Located(..) ) -import NameEnv ( emptyNameEnv ) -import NameSet ( NameSet, emptyDUs, emptyNameSet, unionNameSets, addOneToNameSet ) -import OccName ( emptyOccEnv, tidyOccName ) -import Bag ( emptyBag ) +import HsSyn hiding (LIE) +import HscTypes +import Module +import RdrName +import Name +import TcType +import InstEnv +import FamInstEnv + +import Var +import Id +import VarSet +import VarEnv +import ErrUtils +import SrcLoc +import NameEnv +import NameSet +import OccName +import Bag import Outputable -import UniqSupply ( UniqSupply, mkSplitUniqSupply, uniqFromSupply, uniqsFromSupply, splitUniqSupply ) -import UniqFM ( unitUFM ) -import Unique ( Unique ) -import DynFlags ( DynFlags(..), DynFlag(..), dopt, dopt_set, - dopt_unset, GhcMode ) -import StaticFlags ( opt_PprStyle_Debug ) -import FastString ( FastString ) -import Bag ( snocBag, unionBags ) -import Panic ( showException ) +import UniqSupply +import UniqFM +import Unique +import DynFlags +import StaticFlags +import FastString +import Panic -import IO ( stderr ) -import DATA_IOREF ( newIORef, readIORef ) -import EXCEPTION ( Exception ) +import System.IO +import Data.IORef +import Control.Exception \end{code} diff --git a/compiler/typecheck/TcTyDecls.lhs b/compiler/typecheck/TcTyDecls.lhs index 7d4ebfa..04602ac 100644 --- a/compiler/typecheck/TcTyDecls.lhs +++ b/compiler/typecheck/TcTyDecls.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1999 % @@ -16,25 +17,22 @@ module TcTyDecls( #include "HsVersions.h" -import TypeRep ( Type(..), TyNote(..), PredType(..) ) -- friend -import HsSyn ( TyClDecl(..), HsPred(..), LTyClDecl, isClassDecl ) -import RnHsSyn ( extractHsTyNames ) -import Type ( predTypeRep, tcView ) -import HscTypes ( TyThing(..), ModDetails(..), availsToNameSet ) -import TyCon ( TyCon, tyConArity, tyConDataCons, tyConTyVars, - isSynTyCon, isAlgTyCon, - tyConName, isNewTyCon, isProductTyCon, newTyConRhs, - isOpenTyCon ) -import Class ( classTyCon ) -import DataCon ( dataConOrigArgTys ) -import Var ( TyVar ) +import TypeRep +import HsSyn +import RnHsSyn +import Type +import HscTypes +import TyCon +import Class +import DataCon +import Var import VarSet -import Name ( Name, isTyVarName ) +import Name import NameEnv import NameSet -import Digraph ( SCC(..), stronglyConnComp, stronglyConnCompR ) -import BasicTypes ( RecFlag(..) ) -import SrcLoc ( Located(..), unLoc ) +import Digraph +import BasicTypes +import SrcLoc import Outputable \end{code} diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index cd4c4c7..cb1c68b 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -131,44 +131,7 @@ module TcType ( -- friends: import TypeRep ( Type(..), funTyCon, Kind ) -- friend -import Type ( -- Re-exports - tyVarsOfType, tyVarsOfTypes, tyVarsOfPred, - tyVarsOfTheta, Kind, PredType(..), KindVar, - ThetaType, isUnliftedTypeKind, unliftedTypeKind, - argTypeKind, - liftedTypeKind, openTypeKind, mkArrowKind, - tySuperKind, isLiftedTypeKind, - mkArrowKinds, mkForAllTy, mkForAllTys, - defaultKind, isSubArgTypeKind, isSubOpenTypeKind, - mkFunTy, mkFunTys, zipFunTys, - mkTyConApp, mkAppTy, - mkAppTys, applyTy, applyTys, - mkTyVarTy, mkTyVarTys, mkTyConTy, mkPredTy, - mkPredTys, isUnLiftedType, - isUnboxedTupleType, isPrimitiveType, - splitTyConApp_maybe, - tidyTopType, tidyType, tidyPred, tidyTypes, - tidyFreeTyVars, tidyOpenType, tidyOpenTypes, - tidyTyVarBndr, tidyOpenTyVar, - tidyOpenTyVars, tidyKind, - isSubKind, tcView, - - tcEqType, tcEqTypes, tcCmpType, tcCmpTypes, - tcEqPred, tcCmpPred, tcEqTypeX, eqKind, - - TvSubst(..), - TvSubstEnv, emptyTvSubst, mkTvSubst, zipTyEnv, - mkOpenTvSubst, zipOpenTvSubst, zipTopTvSubst, mkTopTvSubst, - getTvSubstEnv, setTvSubstEnv, getTvInScope, extendTvInScope, - extendTvSubst, extendTvSubstList, isInScope, notElemTvSubst, - substTy, substTys, substTyWith, substTheta, - substTyVar, substTyVarBndr, substPred, lookupTyVar, - - typeKind, repType, coreView, repSplitAppTy_maybe, - pprKind, pprParendKind, - pprType, pprParendType, pprTyThingCategory, - pprPred, pprTheta, pprThetaArrow, pprClassPred - ) +import Type import TyCon ( TyCon, isUnLiftedTyCon, isSynTyCon, isOpenTyCon, synTyConDefn, tyConUnique ) import DataCon ( DataCon, dataConStupidTheta, dataConResTys ) @@ -193,7 +156,8 @@ import Maybes ( maybeToBool, expectJust, mapCatMaybes ) import ListSetOps ( hasNoDups ) import List ( nubBy ) import Outputable -import DATA_IOREF + +import Data.IORef \end{code} @@ -864,10 +828,6 @@ getClassPredTys :: PredType -> (Class, [Type]) getClassPredTys (ClassP clas tys) = (clas, tys) getClassPredTys other = panic "getClassPredTys" -isEqPred :: PredType -> Bool -isEqPred (EqPred {}) = True -isEqPred _ = False - mkDictTy :: Class -> [Type] -> Type mkDictTy clas tys = mkPredTy (ClassP clas tys) -- 1.7.10.4