From: Simon Marlow Date: Wed, 11 Oct 2006 20:01:10 +0000 (+0000) Subject: More import tidying and fixing the stage 2 build X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=ab22f4e6456820c1b5169d75f5975a94e61f54ce More import tidying and fixing the stage 2 build --- diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs index ddeffb7..b0de6f2 100644 --- a/compiler/coreSyn/CoreUtils.lhs +++ b/compiler/coreSyn/CoreUtils.lhs @@ -69,10 +69,7 @@ import Outputable import DynFlags import TysPrim import FastString - -#ifdef DEBUG import Util -#endif import GHC.Exts -- For `xori` \end{code} diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index d859d86..f246412 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1412,14 +1412,10 @@ thLib = mkTHModule FSLIT("Language.Haskell.TH.Lib") mkTHModule m = mkModule thPackageId (mkModuleNameFS m) -mk_known_key_name mod space str uniq - = mkExternalName uniq mod (mkOccNameFS space str) - Nothing noSrcLoc - -libFun = mk_known_key_name thLib OccName.varName -libTc = mk_known_key_name thLib OccName.tcName -thFun = mk_known_key_name thSyn OccName.varName -thTc = mk_known_key_name thSyn OccName.tcName +libFun = mk_known_key_name OccName.varName thLib +libTc = mk_known_key_name OccName.tcName thLib +thFun = mk_known_key_name OccName.varName thSyn +thTc = mk_known_key_name OccName.tcName thSyn -------------------- TH.Syntax ----------------------- qTyConName = thTc FSLIT("Q") qTyConKey diff --git a/compiler/ghci/ByteCodeAsm.lhs b/compiler/ghci/ByteCodeAsm.lhs index e332413..e1346a9 100644 --- a/compiler/ghci/ByteCodeAsm.lhs +++ b/compiler/ghci/ByteCodeAsm.lhs @@ -1,7 +1,8 @@ % -% (c) The University of Glasgow 2002 +% (c) The University of Glasgow 2002-2006 % -\section[ByteCodeLink]{Bytecode assembler and linker} + +ByteCodeLink: Bytecode assembler and linker \begin{code} {-# OPTIONS -optc-DNON_POSIX_SOURCE #-} @@ -18,17 +19,17 @@ module ByteCodeAsm ( #include "HsVersions.h" import ByteCodeInstr -import ByteCodeItbls ( ItblEnv, mkITbls ) +import ByteCodeItbls -import Name ( Name, getName ) +import Name import NameSet -import FiniteMap ( addToFM, lookupFM, emptyFM ) -import Literal ( Literal(..) ) -import TyCon ( TyCon ) -import PrimOp ( PrimOp ) -import Constants ( wORD_SIZE ) -import FastString ( FastString(..) ) -import SMRep ( CgRep(..), StgWord ) +import FiniteMap +import Literal +import TyCon +import PrimOp +import Constants +import FastString +import SMRep import FiniteMap import Outputable diff --git a/compiler/ghci/ByteCodeFFI.lhs b/compiler/ghci/ByteCodeFFI.lhs index ef3fd3e..c5bdc2c 100644 --- a/compiler/ghci/ByteCodeFFI.lhs +++ b/compiler/ghci/ByteCodeFFI.lhs @@ -1,7 +1,8 @@ % -% (c) The University of Glasgow 2001 +% (c) The University of Glasgow 2001-2006 % -\section[ByteCodeGen]{Generate machine-code sequences for foreign import} + +ByteCodeGen: Generate machine-code sequences for foreign import \begin{code} module ByteCodeFFI ( mkMarshalCode, moan64 ) where @@ -9,21 +10,20 @@ module ByteCodeFFI ( mkMarshalCode, moan64 ) where #include "HsVersions.h" import Outputable -import SMRep ( CgRep(..), cgRepSizeW ) -import ForeignCall ( CCallConv(..) ) +import SMRep +import ForeignCall import Panic -- DON'T remove apparently unused imports here .. -- there is ifdeffery below import Control.Exception ( throwDyn ) -import DATA_BITS ( Bits(..), shiftR, shiftL ) -import Foreign ( newArray ) +import Data.Bits ( Bits(..), shiftR, shiftL ) +import Foreign ( newArray, Ptr ) import Data.List ( mapAccumL ) -import DATA_WORD ( Word8, Word32 ) -import Foreign ( Ptr ) +import Data.Word ( Word8, Word32 ) import System.IO.Unsafe ( unsafePerformIO ) -import IO ( hPutStrLn, stderr ) +import System.IO ( hPutStrLn, stderr ) -- import Debug.Trace ( trace ) \end{code} diff --git a/compiler/ghci/ByteCodeGen.lhs b/compiler/ghci/ByteCodeGen.lhs index 40a20cc..be068d2 100644 --- a/compiler/ghci/ByteCodeGen.lhs +++ b/compiler/ghci/ByteCodeGen.lhs @@ -1,7 +1,8 @@ % -% (c) The University of Glasgow 2002 +% (c) The University of Glasgow 2002-2006 % -\section[ByteCodeGen]{Generate bytecode from Core} + +ByteCodeGen: Generate bytecode from Core \begin{code} module ByteCodeGen ( UnlinkedBCO, byteCodeGen, coreExprToBCOs ) where @@ -9,48 +10,41 @@ module ByteCodeGen ( UnlinkedBCO, byteCodeGen, coreExprToBCOs ) where #include "HsVersions.h" import ByteCodeInstr -import ByteCodeFFI ( mkMarshalCode, moan64 ) -import ByteCodeAsm ( CompiledByteCode(..), UnlinkedBCO, - assembleBCO, assembleBCOs, iNTERP_STACK_CHECK_THRESH ) -import ByteCodeLink ( lookupStaticPtr ) +import ByteCodeFFI +import ByteCodeAsm +import ByteCodeLink import Outputable -import Name ( Name, getName, mkSystemVarName ) +import Name import Id import FiniteMap -import ForeignCall ( ForeignCall(..), CCallTarget(..), CCallSpec(..) ) -import HscTypes ( TypeEnv, typeEnvTyCons, typeEnvClasses ) -import CoreUtils ( exprType ) +import ForeignCall +import HscTypes +import CoreUtils import CoreSyn -import PprCore ( pprCoreExpr ) -import Literal ( Literal(..), literalType ) -import PrimOp ( PrimOp(..) ) -import CoreFVs ( freeVars ) -import Type ( isUnLiftedType, splitTyConApp_maybe ) -import DataCon ( DataCon, dataConTag, fIRST_TAG, dataConTyCon, - isUnboxedTupleCon, isNullaryRepDataCon, dataConWorkId, - dataConRepArity ) -import TyCon ( TyCon, tyConFamilySize, isDataTyCon, - tyConDataCons, isUnboxedTupleTyCon ) -import Class ( Class, classTyCon ) -import Type ( Type, repType, splitFunTys, dropForAlls, pprType ) +import PprCore +import Literal +import PrimOp +import CoreFVs +import Type +import DataCon +import TyCon +import Class +import Type import Util -import DataCon ( dataConRepArity ) -import Var ( isTyVar ) -import VarSet ( VarSet, varSetElems ) -import TysPrim ( arrayPrimTyCon, mutableArrayPrimTyCon, - byteArrayPrimTyCon, mutableByteArrayPrimTyCon - ) -import DynFlags ( DynFlags, DynFlag(..) ) -import ErrUtils ( showPass, dumpIfSet_dyn ) -import Unique ( mkPseudoUniqueE ) -import FastString ( FastString(..), unpackFS ) -import Panic ( GhcException(..) ) -import SMRep ( typeCgRep, arrWordsHdrSize, arrPtrsHdrSize, StgWord, - CgRep(..), cgRepSizeW, isFollowableArg, idCgRep ) -import Bitmap ( intsToReverseBitmap, mkBitmap ) +import DataCon +import Var +import VarSet +import TysPrim +import DynFlags +import ErrUtils +import Unique +import FastString +import Panic +import SMRep +import Bitmap import OrdList -import Constants ( wORD_SIZE ) +import Constants import Data.List ( intersperse, sortBy, zip4, zip6, partition ) import Foreign ( Ptr, castPtr, mallocBytes, pokeByteOff, Word8, @@ -101,7 +95,7 @@ coreExprToBCOs dflags expr -- create a totally bogus name for the top-level BCO; this -- should be harmless, since it's never used for anything let invented_name = mkSystemVarName (mkPseudoUniqueE 0) FSLIT("ExprTopLevel") - invented_id = mkLocalId invented_name (panic "invented_id's type") + invented_id = Id.mkLocalId invented_name (panic "invented_id's type") (BcM_State final_ctr mallocd, proto_bco) <- runBc (schemeTopBind (invented_id, freeVars expr)) diff --git a/compiler/ghci/ByteCodeInstr.lhs b/compiler/ghci/ByteCodeInstr.lhs index 7bd4408..b76207e 100644 --- a/compiler/ghci/ByteCodeInstr.lhs +++ b/compiler/ghci/ByteCodeInstr.lhs @@ -1,7 +1,7 @@ % -% (c) The University of Glasgow 2000 +% (c) The University of Glasgow 2000-2006 % -\section[ByteCodeInstrs]{Bytecode instruction definitions} +ByteCodeInstrs: Bytecode instruction definitions \begin{code} module ByteCodeInstr ( @@ -12,15 +12,16 @@ module ByteCodeInstr ( #include "../includes/MachDeps.h" import Outputable -import Name ( Name ) -import Id ( Id ) +import Name +import Id import CoreSyn -import PprCore ( pprCoreExpr, pprCoreAlt ) -import Literal ( Literal ) -import DataCon ( DataCon ) -import VarSet ( VarSet ) -import PrimOp ( PrimOp ) -import SMRep ( StgWord, CgRep ) +import PprCore +import Literal +import DataCon +import VarSet +import PrimOp +import SMRep + import GHC.Ptr -- ---------------------------------------------------------------------------- diff --git a/compiler/ghci/ByteCodeItbls.lhs b/compiler/ghci/ByteCodeItbls.lhs index 6513ff6..d990da2 100644 --- a/compiler/ghci/ByteCodeItbls.lhs +++ b/compiler/ghci/ByteCodeItbls.lhs @@ -1,10 +1,9 @@ % -% (c) The University of Glasgow 2000 +% (c) The University of Glasgow 2000-2006 % -\section[ByteCodeItbls]{Generate infotables for interpreter-made bytecodes} +ByteCodeItbls: Generate infotables for interpreter-made bytecodes \begin{code} - {-# OPTIONS -optc-DNON_POSIX_SOURCE #-} module ByteCodeItbls ( ItblEnv, ItblPtr, mkITbls ) where @@ -23,14 +22,10 @@ import Util ( lengthIs, listLengthCmp ) import Foreign import Foreign.C -import DATA_BITS ( Bits(..), shiftR ) +import Data.Bits ( Bits(..), shiftR ) import GHC.Exts ( Int(I#), addr2Int# ) -#if __GLASGOW_HASKELL__ < 503 -import Ptr ( Ptr(..) ) -#else import GHC.Ptr ( Ptr(..) ) -#endif \end{code} %************************************************************************ diff --git a/compiler/ghci/ByteCodeLink.lhs b/compiler/ghci/ByteCodeLink.lhs index 6bca06a..fd66545 100644 --- a/compiler/ghci/ByteCodeLink.lhs +++ b/compiler/ghci/ByteCodeLink.lhs @@ -1,10 +1,9 @@ % -% (c) The University of Glasgow 2000 +% (c) The University of Glasgow 2000-2006 % -\section[ByteCodeLink]{Bytecode assembler and linker} +ByteCodeLink: Bytecode assembler and linker \begin{code} - {-# OPTIONS -optc-DNON_POSIX_SOURCE #-} module ByteCodeLink ( @@ -15,21 +14,20 @@ module ByteCodeLink ( #include "HsVersions.h" -import ByteCodeItbls ( ItblEnv, ItblPtr ) -import ByteCodeAsm ( UnlinkedBCO(..), BCOPtr(..), sizeSS, ssElts ) -import ObjLink ( lookupSymbol ) +import ByteCodeItbls +import ByteCodeAsm +import ObjLink -import Name ( Name, nameModule, nameOccName ) +import Name import NameEnv -import OccName ( occNameFS ) -import PrimOp ( PrimOp, primOpOcc ) +import OccName +import PrimOp import Module -import PackageConfig ( mainPackageId, packageIdFS ) -import FastString ( FastString(..), unpackFS, zEncodeFS ) -import Panic ( GhcException(..) ) +import PackageConfig +import FastString +import Panic #ifdef DEBUG -import Name ( isExternalName ) import Outputable #endif diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 0685168..159a5ce 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -3,7 +3,7 @@ -- -- GHC Interactive User Interface -- --- (c) The GHC Team 2005 +-- (c) The GHC Team 2005-2006 -- ----------------------------------------------------------------------------- module InteractiveUI ( @@ -17,49 +17,40 @@ module InteractiveUI ( import GHC.Exts ( Int(..), Ptr(..), int2Addr# ) import Foreign.StablePtr ( deRefStablePtr, castPtrToStablePtr ) import System.IO.Unsafe ( unsafePerformIO ) -import Var ( Id, globaliseId, idName, idType ) -import HscTypes ( Session(..), InteractiveContext(..), HscEnv(..) - , extendTypeEnvWithIds ) -import RdrName ( extendLocalRdrEnv, mkRdrUnqual, lookupLocalRdrEnv ) -import NameEnv ( delListFromNameEnv ) -import TcType ( tidyTopType ) -import qualified Id ( setIdType ) -import IdInfo ( GlobalIdDetails(..) ) -import Linker ( HValue, extendLinkEnv, withExtendedLinkEnv, - initDynLinker ) -import PrelNames ( breakpointJumpName, breakpointCondJumpName ) +import Var +import HscTypes +import RdrName +import NameEnv +import TcType +import qualified Id +import IdInfo +import PrelNames #endif -- The GHC interface import qualified GHC -import GHC ( Session, dopt, DynFlag(..), Target(..), - TargetId(..), DynFlags(..), - pprModule, Type, Module, ModuleName, SuccessFlag(..), - TyThing(..), Name, LoadHowMuch(..), Phase, - GhcException(..), showGhcException, - CheckedModule(..), SrcLoc ) -import DynFlags ( allFlags ) -import Packages ( PackageState(..) ) -import PackageConfig ( InstalledPackageInfo(..) ) -import UniqFM ( eltsUFM ) +import GHC ( Session, LoadHowMuch(..), Target(..), TargetId(..), + Type, Module, ModuleName, TyThing(..), Phase ) +import DynFlags +import Packages +import PackageConfig +import UniqFM import PprTyThing import Outputable --- for createtags (should these come via GHC?) -import Name ( nameSrcLoc, nameModule, nameOccName ) -import OccName ( pprOccName ) -import SrcLoc ( isGoodSrcLoc, srcLocFile, srcLocLine, srcLocCol ) +-- for createtags +import Name +import OccName +import SrcLoc -- Other random utilities -import Digraph ( flattenSCCs ) -import BasicTypes ( failed, successIf ) -import Panic ( panic, installSignalHandlers ) +import Digraph +import BasicTypes +import Panic hiding (showException) import Config -import StaticFlags ( opt_IgnoreDotGhci ) -import Linker ( showLinkerState, linkPackages ) -import Util ( removeSpaces, handle, global, toArgs, - looksLikeModuleName, prefixMatch, sortLe, - joinFileName ) +import StaticFlags +import Linker +import Util #ifndef mingw32_HOST_OS import System.Posix @@ -718,7 +709,8 @@ info s = do { let names = words s filterOutChildren :: [Name] -> [Name] filterOutChildren names = filter (not . parent_is_there) names where parent_is_there n - | Just p <- GHC.nameParent_maybe n = p `elem` names +-- | Just p <- GHC.nameParent_maybe n = p `elem` names +-- ToDo!! | otherwise = False pprInfo exts (thing, fixity, insts) @@ -864,7 +856,7 @@ checkModule m = do case result of Nothing -> io $ putStrLn "Nothing" Just r -> io $ putStrLn (showSDoc ( - case checkedModuleInfo r of + case GHC.checkedModuleInfo r of Just cm | Just scope <- GHC.modInfoTopLevelScope cm -> let (local,global) = partition ((== modl) . GHC.moduleName . GHC.nameModule) scope diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 976fe92..819e620 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -1,5 +1,5 @@ % -% (c) The University of Glasgow 2005 +% (c) The University of Glasgow 2005-2006 % -- -------------------------------------- @@ -12,7 +12,6 @@ necessary. \begin{code} - {-# OPTIONS -optc-DNON_POSIX_SOURCE -#include "Linker.h" #-} module Linker ( HValue, showLinkerState, @@ -23,48 +22,43 @@ module Linker ( HValue, showLinkerState, #include "HsVersions.h" -import ObjLink ( loadDLL, loadObj, unloadObj, resolveObjs, initObjLinker ) -import ByteCodeLink ( HValue, ClosureEnv, extendClosureEnv, linkBCO ) -import ByteCodeItbls ( ItblEnv ) -import ByteCodeAsm ( CompiledByteCode(..), bcoFreeNames, UnlinkedBCO(..)) +import ObjLink +import ByteCodeLink +import ByteCodeItbls +import ByteCodeAsm import Packages -import DriverPhases ( isObjectFilename, isDynLibFilename ) -import Finder ( findHomeModule, findObjectLinkableMaybe, - FindResult(..) ) +import DriverPhases +import Finder import HscTypes -import Name ( Name, nameModule, isExternalName, isWiredInName ) +import Name import NameEnv -import NameSet ( nameSetToList ) -import UniqFM ( lookupUFM ) +import NameSet +import UniqFM import Module -import ListSetOps ( minusList ) -import DynFlags ( DynFlags(..), getOpts ) -import BasicTypes ( SuccessFlag(..), succeeded, failed ) +import ListSetOps +import DynFlags +import BasicTypes import Outputable -import PackageConfig ( rtsPackageId ) -import Panic ( GhcException(..) ) -import Util ( zipLazy, global, joinFileExt, joinFileName, - replaceFilenameSuffix ) -import StaticFlags ( v_Ld_inputs, v_Build_tag ) -import ErrUtils ( debugTraceMsg, mkLocMessage ) -import DriverPhases ( phaseInputExt, Phase(..) ) -import SrcLoc ( SrcSpan ) +import PackageConfig +import Panic +import Util +import StaticFlags +import ErrUtils +import DriverPhases +import SrcLoc -- Standard libraries -import Control.Monad ( when, filterM, foldM ) +import Control.Monad -import Data.IORef ( IORef, readIORef, writeIORef, modifyIORef ) -import Data.List ( partition, nub ) +import Data.IORef +import Data.List -import System.IO ( putStr, putStrLn, hPutStrLn, stderr, fixIO ) -import System.Directory ( doesFileExist ) +import System.IO +import System.Directory -import Control.Exception ( block, throwDyn, bracket ) -import Maybe ( fromJust ) -#ifdef DEBUG -import Maybe ( isJust ) -#endif +import Control.Exception +import Data.Maybe #if __GLASGOW_HASKELL__ >= 503 import GHC.IOBase ( IO(..) ) diff --git a/compiler/ghci/ObjLink.lhs b/compiler/ghci/ObjLink.lhs index 5988165..f46532f 100644 --- a/compiler/ghci/ObjLink.lhs +++ b/compiler/ghci/ObjLink.lhs @@ -1,5 +1,5 @@ % -% (c) The University of Glasgow, 2000 +% (c) The University of Glasgow, 2000-2006 % -- --------------------------------------------------------------------------- @@ -22,15 +22,14 @@ module ObjLink ( resolveObjs -- :: IO SuccessFlag ) where -import Monad ( when ) - -import Foreign.C -import Foreign ( nullPtr ) import Panic ( panic ) import BasicTypes ( SuccessFlag, successIf ) import Config ( cLeadingUnderscore ) import Outputable +import Control.Monad ( when ) +import Foreign.C +import Foreign ( nullPtr ) import GHC.Exts ( Ptr(..), unsafeCoerce# ) -- --------------------------------------------------------------------------- diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs index dff6a14..71cfaaf 100644 --- a/compiler/hsSyn/Convert.lhs +++ b/compiler/hsSyn/Convert.lhs @@ -1,45 +1,42 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % This module converts Template Haskell syntax into HsSyn - \begin{code} -module Convert( convertToHsExpr, convertToHsDecls, convertToHsType, thRdrName ) where +module Convert( convertToHsExpr, convertToHsDecls, + convertToHsType, thRdrName ) where #include "HsVersions.h" -import Language.Haskell.TH as TH hiding (sigP) -import Language.Haskell.TH.Syntax as TH - import HsSyn as Hs -import qualified Class (FunDep) -import RdrName ( RdrName, mkRdrUnqual, mkRdrQual, mkOrig, getRdrName, nameRdrName ) -import qualified Name ( Name, mkInternalName, getName ) -import Module ( ModuleName, mkModuleName, mkModule ) -import RdrHsSyn ( mkClassDecl, mkTyData ) +import qualified Class +import RdrName +import qualified Name +import Module +import RdrHsSyn import qualified OccName -import PackageConfig ( PackageId, stringToPackageId ) -import OccName ( startsVarId, startsVarSym, startsConId, startsConSym, - pprNameSpace ) -import SrcLoc ( Located(..), SrcSpan ) -import Type ( Type ) -import TysWiredIn ( unitTyCon, tupleTyCon, tupleCon, trueDataCon, nilDataCon, consDataCon ) -import BasicTypes( Boxity(..) ) -import ForeignCall ( Safety(..), CCallConv(..), CCallTarget(..), - CExportSpec(..)) -import Char ( isAscii, isAlphaNum, isAlpha ) -import List ( partition ) -import Unique ( Unique, mkUniqueGrimily ) -import ErrUtils ( Message ) -import GLAEXTS ( Int(..), Int# ) -import SrcLoc ( noSrcLoc ) -import Bag ( listToBag ) +import PackageConfig +import OccName +import SrcLoc +import Type +import TysWiredIn +import BasicTypes +import ForeignCall +import Char +import List +import Unique +import ErrUtils +import Bag import FastString import Outputable +import Language.Haskell.TH as TH hiding (sigP) +import Language.Haskell.TH.Syntax as TH +import GHC.Exts ------------------------------------------------------------------- -- The external interface @@ -230,8 +227,8 @@ cvtForD (ExportF callconv as nm ty) ; let e = CExport (CExportStatic (mkFastString as) (cvt_conv callconv)) ; return $ ForeignExport nm' ty' e } -cvt_conv CCall = CCallConv -cvt_conv StdCall = StdCallConv +cvt_conv TH.CCall = CCallConv +cvt_conv TH.StdCall = StdCallConv parse_ccall_impent :: String -> String -> Maybe (FastString, CImportSpec) parse_ccall_impent nm s diff --git a/compiler/hsSyn/HsBinds.lhs b/compiler/hsSyn/HsBinds.lhs index 8845522..ebac06f 100644 --- a/compiler/hsSyn/HsBinds.lhs +++ b/compiler/hsSyn/HsBinds.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[HsBinds]{Abstract syntax: top-level bindings and signatures} @@ -15,18 +16,18 @@ import {-# SOURCE #-} HsExpr ( HsExpr, pprExpr, LHsExpr, GRHSs, pprPatBind ) import {-# SOURCE #-} HsPat ( LPat ) -import HsTypes ( LHsType, PostTcType ) -import PprCore ( {- instances -} ) -import Coercion ( Coercion ) -import Type ( Type, pprParendType ) -import Name ( Name ) -import NameSet ( NameSet, elemNameSet ) -import BasicTypes ( IPName, RecFlag(..), InlineSpec(..), Fixity ) +import HsTypes +import PprCore +import Coercion +import Type +import Name +import NameSet +import BasicTypes import Outputable -import SrcLoc ( Located(..), SrcSpan, unLoc ) -import Util ( sortLe ) -import Var ( TyVar, DictId, Id, Var ) -import Bag ( Bag, emptyBag, isEmptyBag, bagToList, unionBags, unionManyBags ) +import SrcLoc +import Util +import Var +import Bag \end{code} %************************************************************************ diff --git a/compiler/hsSyn/HsDecls.lhs b/compiler/hsSyn/HsDecls.lhs index 733a8ea..049f597 100644 --- a/compiler/hsSyn/HsDecls.lhs +++ b/compiler/hsSyn/HsDecls.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[HsDecls]{Abstract syntax: global declarations} + +HsDecls: Abstract syntax: global declarations Definitions for: @TyDecl@ and @oCnDecl@, @ClassDecl@, @InstDecl@, @DefaultDecl@ and @ForeignDecl@. @@ -33,27 +35,25 @@ module HsDecls ( import {-# SOURCE #-} HsExpr( HsExpr, pprExpr ) -- Because Expr imports Decls via HsBracket -import HsBinds ( HsValBinds(..), HsBind, LHsBinds, plusHsValBinds, - Sig(..), LSig, LFixitySig, pprLHsBinds, - emptyValBindsIn, emptyValBindsOut ) -import HsPat ( HsConDetails(..), hsConArgs, HsRecField(..) ) -import HsImpExp ( pprHsVar ) +import HsBinds +import HsPat +import HsImpExp import HsTypes -import HsDoc ( HsDoc, LHsDoc, ppr_mbDoc ) -import NameSet ( NameSet ) -import CoreSyn ( RuleName ) -import {- Kind parts of -} Type ( Kind, pprKind ) -import BasicTypes ( Activation(..), DeprecTxt ) -import ForeignCall ( CCallTarget(..), DNCallSpec, CCallConv, Safety, - CExportSpec(..), CLabelString ) +import HsDoc +import NameSet +import CoreSyn +import {- Kind parts of -} Type +import BasicTypes +import ForeignCall -- others: -import Class ( FunDep, pprFundeps ) +import Class import Outputable -import Util ( count ) -import SrcLoc ( Located(..), unLoc, noLoc ) +import Util +import SrcLoc import FastString -import Maybe ( isJust ) + +import Data.Maybe ( isJust ) \end{code} %************************************************************************ diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs index 2d111ee..2360337 100644 --- a/compiler/hsSyn/HsExpr.lhs +++ b/compiler/hsSyn/HsExpr.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[HsExpr]{Abstract Haskell syntax: expressions} + +HsExpr: Abstract Haskell syntax: expressions \begin{code} module HsExpr where @@ -9,19 +11,18 @@ module HsExpr where #include "HsVersions.h" -- friends: -import HsDecls ( HsGroup ) -import HsPat ( LPat ) -import HsLit ( HsLit(..), HsOverLit ) -import HsTypes ( LHsType, PostTcType ) -import HsImpExp ( isOperator, pprHsVar ) -import HsBinds ( HsLocalBinds, DictBinds, isEmptyLocalBinds, - HsWrapper, pprHsWrapper ) +import HsDecls +import HsPat +import HsLit +import HsTypes +import HsImpExp +import HsBinds -- others: -import Var ( Id ) -import Name ( Name ) -import BasicTypes ( IPName, Boxity, tupleParens, Arity, Fixity(..) ) -import SrcLoc ( Located(..), unLoc ) +import Var +import Name +import BasicTypes +import SrcLoc import Outputable import FastString \end{code} diff --git a/compiler/hsSyn/HsImpExp.lhs b/compiler/hsSyn/HsImpExp.lhs index 767be42..bbe84e3 100644 --- a/compiler/hsSyn/HsImpExp.lhs +++ b/compiler/hsSyn/HsImpExp.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[HsImpExp]{Abstract syntax: imports, exports, interfaces} + +HsImpExp: Abstract syntax: imports, exports, interfaces \begin{code} module HsImpExp where diff --git a/compiler/hsSyn/HsLit.lhs b/compiler/hsSyn/HsLit.lhs index c6d7e5d..f4c9cf7 100644 --- a/compiler/hsSyn/HsLit.lhs +++ b/compiler/hsSyn/HsLit.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[HsLit]{Abstract syntax: source-language literals} diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs index f2ba6b3..65cc304 100644 --- a/compiler/hsSyn/HsPat.lhs +++ b/compiler/hsSyn/HsPat.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[PatSyntax]{Abstract Haskell syntax---patterns} @@ -23,21 +24,20 @@ module HsPat ( import {-# SOURCE #-} HsExpr ( SyntaxExpr ) -- friends: -import HsBinds ( DictBinds, HsBind(..), HsWrapper, isIdHsWrapper, pprHsWrapper, - emptyLHsBinds, pprLHsBinds ) -import HsLit ( HsLit(HsCharPrim), HsOverLit ) -import HsTypes ( LHsType, PostTcType ) -import HsDoc ( LHsDoc, ppr_mbDoc ) -import BasicTypes ( Boxity, tupleParens ) +import HsBinds +import HsLit +import HsTypes +import HsDoc +import BasicTypes -- others: import PprCore ( {- instance OutputableBndr TyVar -} ) -import TysWiredIn ( nilDataCon, charDataCon, charTy ) -import Var ( TyVar ) -import DataCon ( DataCon, dataConTyCon ) -import TyCon ( isProductTyCon ) +import TysWiredIn +import Var +import DataCon +import TyCon import Outputable -import Type ( Type ) -import SrcLoc ( Located(..), unLoc, noLoc ) +import Type +import SrcLoc \end{code} diff --git a/compiler/hsSyn/HsSyn.lhs b/compiler/hsSyn/HsSyn.lhs index fb5162a..6ed59ee 100644 --- a/compiler/hsSyn/HsSyn.lhs +++ b/compiler/hsSyn/HsSyn.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section{Haskell abstract syntax definition} diff --git a/compiler/hsSyn/HsTypes.lhs b/compiler/hsSyn/HsTypes.lhs index ad7facb..1ec0966 100644 --- a/compiler/hsSyn/HsTypes.lhs +++ b/compiler/hsSyn/HsTypes.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[HsTypes]{Abstract syntax: user-defined types} + +HsTypes: Abstract syntax: user-defined types \begin{code} module HsTypes ( @@ -30,14 +32,11 @@ module HsTypes ( import {-# SOURCE #-} HsExpr ( HsSplice, pprSplice ) -import Type ( Type ) -import {- Kind parts of -} - Type ( {- instance Outputable Kind -} Kind, - pprParendKind, pprKind, isLiftedTypeKind ) -import HsDoc ( LHsDoc, HsDoc ) -import BasicTypes ( IPName, Boxity, tupleParens ) -import SrcLoc ( Located(..), unLoc, noSrcSpan ) -import StaticFlags ( opt_PprStyle_Debug ) +import Type +import HsDoc +import BasicTypes +import SrcLoc +import StaticFlags import Outputable \end{code} diff --git a/compiler/hsSyn/HsUtils.lhs b/compiler/hsSyn/HsUtils.lhs index b0978ec..be4431d 100644 --- a/compiler/hsSyn/HsUtils.lhs +++ b/compiler/hsSyn/HsUtils.lhs @@ -1,5 +1,5 @@ % -% (c) The University of Glasgow, 1992-2003 +% (c) The University of Glasgow, 1992-2006 % Here we collect a variety of helper functions that construct or @@ -24,17 +24,17 @@ import HsTypes import HsLit import HsDecls -import RdrName ( RdrName, getRdrName, mkRdrUnqual ) -import Var ( Id ) -import Type ( Type ) -import DataCon ( DataCon, dataConWrapId, dataConSourceArity ) -import OccName ( mkVarOccFS ) -import Name ( Name ) -import BasicTypes ( RecFlag(..) ) +import RdrName +import Var +import Type +import DataCon +import OccName +import Name +import BasicTypes import SrcLoc -import FastString ( mkFastString ) +import FastString import Outputable -import Util ( nOfThem ) +import Util import Bag \end{code} diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index c786cbb..6295d7d 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -1756,15 +1756,15 @@ getModuleInfo s mdl = withSession s $ \hsc_env -> do getPackageModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo) getPackageModuleInfo hsc_env mdl = do #ifdef GHCI - (_msgs, mb_names) <- getModuleExports hsc_env mdl - case mb_names of + (_msgs, mb_avails) <- getModuleExports hsc_env mdl + case mb_avails of Nothing -> return Nothing - Just names -> do + Just avails -> do eps <- readIORef (hsc_EPS hsc_env) let + names = availsToNameSet avails pte = eps_PTE eps - n_list = nameSetToList names - tys = [ ty | name <- n_list, + tys = [ ty | name <- concatMap availNames avails, Just ty <- [lookupTypeEnv pte name] ] -- return (Just (ModuleInfo { @@ -1925,8 +1925,8 @@ mkExportEnv hsc_env mods = do stuff <- mapM (getModuleExports hsc_env) mods let (_msgs, mb_name_sets) = unzip stuff - gres = [ nameSetToGlobalRdrEnv name_set (moduleName mod) - | (Just name_set, mod) <- zip mb_name_sets mods ] + gres = [ nameSetToGlobalRdrEnv (availsToNameSet avails) (moduleName mod) + | (Just avails, mod) <- zip mb_name_sets mods ] -- return $! foldr plusGlobalRdrEnv emptyGlobalRdrEnv gres diff --git a/compiler/rename/RnNames.lhs b/compiler/rename/RnNames.lhs index e1445c7..ec65f72 100644 --- a/compiler/rename/RnNames.lhs +++ b/compiler/rename/RnNames.lhs @@ -154,7 +154,7 @@ rnImportDecl this_mod (L loc (ImportDecl loc_imp_mod_name want_boot -- Compiler sanity check: if the import didn't say -- {-# SOURCE #-} we should not get a hi-boot file - WARN( not want_boot && mi_boot iface, ppr imp_mod_name ) $ do + WARN( not want_boot && mi_boot iface, ppr imp_mod_name ) (do -- Issue a user warning for a redundant {- SOURCE -} import -- NB that we arrange to read all the ordinary imports before @@ -262,6 +262,7 @@ rnImportDecl this_mod (L loc (ImportDecl loc_imp_mod_name want_boot qual_only as_mod new_imp_details) returnM (new_imp_decl, gbl_env, filtered_avails, imports) + ) warnRedundantSourceImport mod_name = ptext SLIT("Unnecessary {-# SOURCE #-} in the import of module") diff --git a/compiler/typecheck/TcExpr.lhs b/compiler/typecheck/TcExpr.lhs index e2f1d0c..d249716 100644 --- a/compiler/typecheck/TcExpr.lhs +++ b/compiler/typecheck/TcExpr.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[TcExpr]{Typecheck an expression} @@ -11,81 +12,42 @@ module TcExpr ( tcPolyExpr, tcPolyExprNC, #ifdef GHCI /* Only if bootstrapped */ import {-# SOURCE #-} TcSplice( tcSpliceExpr, tcBracket ) -import HsSyn ( nlHsVar ) -import Id ( Id, idName ) -import Name ( isExternalName ) -import TcType ( isTauTy ) -import TcEnv ( checkWellStaged ) -import HsSyn ( nlHsApp ) import qualified DsMeta #endif -import HsSyn ( HsExpr(..), LHsExpr, ArithSeqInfo(..), recBindFields, - HsMatchContext(..), HsRecordBinds, mkHsWrap, hsExplicitTvs, - mkHsApp, mkLHsWrap ) -import TcHsSyn ( hsLitType ) +import HsSyn +import TcHsSyn import TcRnMonad -import TcUnify ( tcInfer, tcSubExp, tcFunResTy, tcGen, boxyUnify, subFunTys, zapToMonotype, stripBoxyType, - boxySplitListTy, boxySplitTyConApp, wrapFunResCoercion, preSubType, - unBox ) -import BasicTypes ( Arity, isMarkedStrict ) -import Inst ( newMethodFromName, newIPDict, instCall, - newMethodWithGivenTy, instStupidTheta ) -import TcBinds ( tcLocalBinds ) -import TcEnv ( tcLookup, tcLookupDataCon, tcLookupField, tcExtendTyVarEnv2 ) -import TcArrows ( tcProc ) -import TcMatches ( tcMatchesCase, tcMatchLambda, tcDoStmts, tcBody, - TcMatchCtxt(..) ) -import TcHsType ( tcHsSigType, UserTypeCtxt(..) ) -import TcPat ( tcOverloadedLit, addDataConStupidTheta, badFieldCon ) -import TcMType ( tcInstTyVars, newFlexiTyVarTy, newBoxyTyVars, - readFilledBox, zonkTcTypes ) -import TcType ( TcType, TcSigmaType, TcRhoType, TvSubst, - BoxySigmaType, BoxyRhoType, ThetaType, - mkTyVarTys, mkFunTys, - tcMultiSplitSigmaTy, tcSplitFunTysN, - tcSplitTyConApp_maybe, - isSigmaTy, mkFunTy, mkTyConApp, - exactTyVarsOfType, exactTyVarsOfTypes, - zipTopTvSubst, zipOpenTvSubst, substTys, substTyVar - ) -import {- Kind parts of -} - Type ( argTypeKind ) - -import Id ( idType, recordSelectorFieldLabel, - isRecordSelector, isNaughtyRecordSelector, - isDataConId_maybe ) -import DataCon ( DataCon, dataConFieldLabels, dataConStrictMarks, - dataConSourceArity, - dataConWrapId, isVanillaDataCon, dataConUnivTyVars, - dataConOrigArgTys ) -import Name ( Name ) -import TyCon ( FieldLabel, tyConStupidTheta, tyConDataCons, - isEnumerationTyCon ) -import Type ( substTheta, substTy ) -import Var ( TyVar, tyVarKind ) -import VarSet ( emptyVarSet, elemVarSet, unionVarSet ) -import TysWiredIn ( boolTy, parrTyCon, tupleTyCon ) -import PrelNames ( enumFromName, enumFromThenName, - enumFromToName, enumFromThenToName, - enumFromToPName, enumFromThenToPName, negateName, - hasKey - ) -import PrimOp ( tagToEnumKey ) - +import TcUnify +import BasicTypes +import Inst +import TcBinds +import TcEnv +import TcArrows +import TcMatches +import TcHsType +import TcPat +import TcMType +import TcType +import Id +import DataCon +import Name +import TyCon +import Type +import Var +import VarSet +import TysWiredIn +import PrelNames +import PrimOp import DynFlags -import StaticFlags ( opt_NoMethodSharing ) -import HscTypes ( TyThing(..) ) -import SrcLoc ( Located(..), unLoc ) +import StaticFlags +import HscTypes +import SrcLoc import Util -import ListSetOps ( assocMaybe ) -import Maybes ( catMaybes ) +import ListSetOps +import Maybes import Outputable import FastString - -#ifdef DEBUG -import TyCon ( tyConArity ) -#endif \end{code} %************************************************************************ diff --git a/compiler/typecheck/TcForeign.lhs b/compiler/typecheck/TcForeign.lhs index 4019feb..705a3c3 100644 --- a/compiler/typecheck/TcForeign.lhs +++ b/compiler/typecheck/TcForeign.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1998 % \section[TcForeign]{Typechecking \tr{foreign} declarations} @@ -22,37 +23,25 @@ module TcForeign import HsSyn import TcRnMonad -import TcHsType ( tcHsSigType, UserTypeCtxt(..) ) -import TcExpr ( tcPolyExpr ) +import TcHsType +import TcExpr -import ForeignCall ( CCallConv(..) ) -import ErrUtils ( Message ) -import Id ( Id, mkLocalId, mkExportedLocalId ) +import ForeignCall +import ErrUtils +import Id #if alpha_TARGET_ARCH -import Type ( typePrimRep ) -import SMRep ( argMachRep, primRepToCgRep, primRepHint ) +import Type +import SMRep +import MachOp #endif -import OccName ( mkForeignExportOcc ) -import Name ( Name, NamedThing(..), mkExternalName ) -import TcType ( Type, tcSplitFunTys, - tcSplitForAllTys, tcSplitIOType_maybe, - isFFIArgumentTy, isFFIImportResultTy, - isFFIExportResultTy, isFFILabelTy, - isFFIExternalTy, isFFIDynArgumentTy, - isFFIDynResultTy, isFFIDotnetTy, isFFIDotnetObjTy, - toDNType - ) -import ForeignCall ( CExportSpec(..), CCallTarget(..), - CLabelString, isCLabelString, - isDynamicTarget, withDNTypes, DNKind(..), DNCallSpec(..) ) -import DynFlags ( DynFlags(..), HscTarget(..) ) +import OccName +import Name +import TcType +import ForeignCall +import DynFlags import Outputable -import SrcLoc ( Located(..), srcSpanStart ) -import Bag ( consBag ) - -#if alpha_TARGET_ARCH -import MachOp ( machRepByteWidth, MachHint(FloatHint) ) -#endif +import SrcLoc +import Bag \end{code} \begin{code} diff --git a/compiler/typecheck/TcGadt.lhs b/compiler/typecheck/TcGadt.lhs index 87f2c8d..4e71827 100644 --- a/compiler/typecheck/TcGadt.lhs +++ b/compiler/typecheck/TcGadt.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % @@ -16,29 +17,26 @@ module TcGadt ( tcUnifyTys, BindFlag(..) ) where -import HsSyn ( HsWrapper(..), idHsWrapper, isIdHsWrapper ) -import Coercion ( Coercion, mkSymCoercion, mkTransCoercion, mkUnsafeCoercion, - mkLeftCoercion, mkRightCoercion, mkCoKind, coercionKindPredTy, - splitCoercionKind, decomposeCo, coercionKind ) -import TcType ( TvSubst(..), TvSubstEnv, substTy, mkTvSubst, - substTyVar, zipTopTvSubst, typeKind, - eqKind, isSubKind, repSplitAppTy_maybe, - tcView, tcGetTyVar_maybe - ) -import Type ( Type, tyVarsOfType, tyVarsOfTypes, tcEqType, mkTyVarTy ) -import TypeRep ( Type(..), PredType(..) ) -import DataCon ( DataCon, dataConUnivTyVars, dataConEqSpec ) -import Var ( CoVar, TyVar, tyVarKind, varUnique ) +#include "HsVersions.h" + +import HsSyn +import Coercion +import Type +import TypeRep +import DataCon +import Var import VarEnv import VarSet -import ErrUtils ( Message ) -import Maybes ( MaybeErr(..), isJust ) -import Control.Monad ( foldM ) +import ErrUtils +import Maybes +import Control.Monad import Outputable -import Unique ( Unique ) -import UniqFM ( ufmToList ) -#include "HsVersions.h" +#ifdef DEBUG +import Unique +import UniqFM +import TcType +#endif \end{code} @@ -261,6 +259,7 @@ type InternalReft = TyVarEnv (Coercion, Type) -- INVARIANT: a->(co,ty) then co :: (a:=:ty) -- Not necessarily idemopotent +#ifdef DEBUG badReftElts :: InternalReft -> [(Unique, (Coercion,Type))] -- Return the BAD elements of the refinement -- Should be empty; used in asserions only @@ -273,6 +272,7 @@ badReftElts env | otherwise = False where (ty1,ty2) = coercionKind co +#endif emptyInternalReft :: InternalReft emptyInternalReft = emptyVarEnv @@ -552,4 +552,4 @@ kindMisMatch tv1 t2 occursCheck tv ty = hang (ptext SLIT("Can't construct the infinite type")) 2 (ppr tv <+> equals <+> ppr ty) -\end{code} \ No newline at end of file +\end{code} diff --git a/compiler/typecheck/TcGenDeriv.lhs b/compiler/typecheck/TcGenDeriv.lhs index 4291c4b..26cec8b 100644 --- a/compiler/typecheck/TcGenDeriv.lhs +++ b/compiler/typecheck/TcGenDeriv.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcGenDeriv]{Generating derived instance declarations} + +TcGenDeriv: Generating derived instance declarations This module is nominally ``subordinate'' to @TcDeriv@, which is the ``official'' interface to deriving-related things. @@ -29,37 +31,29 @@ module TcGenDeriv ( #include "HsVersions.h" import HsSyn -import RdrName ( RdrName, mkVarUnqual, getRdrName, mkRdrUnqual, - mkDerivedRdrName ) -import BasicTypes ( Fixity(..), maxPrecedence, Boxity(..) ) -import DataCon ( isNullarySrcDataCon, dataConTag, - dataConOrigArgTys, dataConSourceArity, fIRST_TAG, - DataCon, dataConName, dataConIsInfix, - dataConFieldLabels ) -import Name ( getOccString, getSrcLoc, Name, NamedThing(..) ) - -import HscTypes ( FixityEnv, lookupFixity ) +import RdrName +import BasicTypes +import DataCon +import Name + +import HscTypes import PrelInfo import PrelNames -import MkId ( eRROR_ID ) -import PrimOp ( PrimOp(..) ) -import SrcLoc ( Located(..), noLoc, srcLocSpan ) -import TyCon ( TyCon, isNewTyCon, tyConDataCons, isEnumerationTyCon, tyConArity, - maybeTyConSingleCon, tyConFamilySize, tyConTyVars, tyConName - ) -import TcType ( isUnLiftedType, tcEqType, Type ) -import TysPrim ( charPrimTy, intPrimTy, wordPrimTy, addrPrimTy, floatPrimTy, doublePrimTy, - intPrimTyCon ) -import TysWiredIn ( charDataCon, intDataCon, floatDataCon, doubleDataCon, - intDataCon_RDR, true_RDR, false_RDR ) -import Util ( zipWithEqual, isSingleton, - zipWith3Equal, nOfThem, zipEqual ) +import MkId +import PrimOp +import SrcLoc +import TyCon +import TcType +import TysPrim +import TysWiredIn +import Util import Constants -import List ( partition, intersperse ) import Outputable import FastString import OccName import Bag + +import Data.List ( partition, intersperse ) \end{code} %************************************************************************ diff --git a/compiler/typecheck/TcHsSyn.lhs b/compiler/typecheck/TcHsSyn.lhs index 851d833..a8d691c 100644 --- a/compiler/typecheck/TcHsSyn.lhs +++ b/compiler/typecheck/TcHsSyn.lhs @@ -1,7 +1,9 @@ - % +% +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1996-1998 % -\section[TcHsSyn]{Specialisations of the @HsSyn@ syntax for the typechecker} + +TcHsSyn: Specialisations of the @HsSyn@ syntax for the typechecker This module is an extension of @HsSyn@ syntax, for use in the type checker. @@ -27,30 +29,26 @@ module TcHsSyn ( import HsSyn -- oodles of it -- others: -import Id ( idType, setIdType, Id ) +import Id import TcRnMonad -import Type ( Type, isLiftedTypeKind, liftedTypeKind, isSubKind, eqKind ) -import TcType ( TcType, TcTyVar, mkTyVarTy, mkTyConApp, isImmutableTyVar ) +import Type +import TcType import qualified Type -import TcMType ( zonkQuantifiedTyVar, zonkType, zonkTcType, writeMetaTyVar ) -import TysPrim ( charPrimTy, intPrimTy, floatPrimTy, - doublePrimTy, addrPrimTy - ) -import TysWiredIn ( charTy, stringTy, intTy, - mkListTy, mkPArrTy, mkTupleTy, unitTy, - voidTy, listTyCon, tupleTyCon ) -import TyCon ( mkPrimTyCon, tyConKind, PrimRep(..) ) -import {- Kind parts of -} Type ( splitKindFunTys ) -import Name ( Name, getOccName, mkInternalName, mkDerivedTyConOcc ) -import Var ( Var, isId, isLocalVar, tyVarKind ) +import TcMType +import TysPrim +import TysWiredIn +import TyCon +import {- Kind parts of -} Type +import Name +import Var import VarSet import VarEnv -import BasicTypes ( Boxity(..), IPName(..), ipNameName, mapIPName ) -import Maybes ( orElse ) -import Unique ( Uniquable(..) ) -import SrcLoc ( noSrcLoc, noLoc, Located(..), unLoc ) -import Util ( mapSnd ) +import BasicTypes +import Maybes +import Unique +import SrcLoc +import Util import Bag import Outputable \end{code} @@ -120,7 +118,7 @@ hsLitType (HsDoublePrim d) = doublePrimTy zonkId :: TcId -> TcM TcId zonkId id = zonkTcType (idType id) `thenM` \ ty' -> - returnM (setIdType id ty') + returnM (Id.setIdType id ty') \end{code} The rest of the zonking is done *after* typechecking. @@ -189,7 +187,7 @@ zonkIdOccs env ids = map (zonkIdOcc env) ids zonkIdBndr :: ZonkEnv -> TcId -> TcM Id zonkIdBndr env id = zonkTcTypeToType env (idType id) `thenM` \ ty' -> - returnM (setIdType id ty') + returnM (Id.setIdType id ty') zonkIdBndrs :: ZonkEnv -> [TcId] -> TcM [Id] zonkIdBndrs env ids = mappM (zonkIdBndr env) ids diff --git a/compiler/typecheck/TcHsType.lhs b/compiler/typecheck/TcHsType.lhs index 78d0b98..3d365ab 100644 --- a/compiler/typecheck/TcHsType.lhs +++ b/compiler/typecheck/TcHsType.lhs @@ -1,4 +1,5 @@ - +% +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[TcMonoType]{Typechecking user-specified @MonoTypes@} @@ -23,41 +24,26 @@ module TcHsType ( #include "HsVersions.h" -import HsSyn ( HsType(..), LHsType, HsTyVarBndr(..), LHsTyVarBndr, - LHsContext, HsPred(..), LHsPred ) -import RnHsSyn ( extractHsTyVars ) +import HsSyn +import RnHsSyn import TcRnMonad -import TcEnv ( tcExtendTyVarEnv, tcExtendKindEnvTvs, - tcLookup, tcLookupClass, tcLookupTyCon, - TyThing(..), getInLocalScope, getScopedTyVarBinds, - wrongThingErr - ) -import TcMType ( newKindVar, - zonkTcKindToKind, - tcInstBoxyTyVar, readFilledBox, - checkValidType - ) -import TcUnify ( boxyUnify, unifyFunKind, checkExpectedKind ) -import TcIface ( checkWiredInTyCon ) -import TcType ( Type, PredType(..), ThetaType, BoxySigmaType, - TcType, TcKind, isRigidTy, - UserTypeCtxt(..), pprUserTypeCtxt, - substTyWith, mkTyVarTys, tcEqType, - tcIsTyVarTy, mkFunTy, mkSigmaTy, mkPredTy, - mkTyConApp, mkAppTys, typeKind ) -import {- Kind parts of -} Type ( Kind, isLiftedTypeKind, liftedTypeKind, ubxTupleKind, - openTypeKind, argTypeKind, splitKindFunTys ) -import Var ( TyVar, mkTyVar, tyVarName ) -import TyCon ( TyCon, tyConKind ) -import Class ( Class, classTyCon ) -import Name ( Name, mkInternalName ) -import OccName ( mkOccName, tvName ) +import TcEnv +import TcMType +import TcUnify +import TcIface +import TcType +import {- Kind parts of -} Type +import Var +import TyCon +import Class +import Name +import OccName import NameSet -import PrelNames ( genUnitTyConName ) -import TysWiredIn ( mkListTy, listTyCon, mkPArrTy, parrTyCon, tupleTyCon ) -import BasicTypes ( Boxity(..) ) -import SrcLoc ( Located(..), unLoc, noLoc, getLoc, srcSpanStart ) -import UniqSupply ( uniqsFromSupply ) +import PrelNames +import TysWiredIn +import BasicTypes +import SrcLoc +import UniqSupply import Outputable \end{code} diff --git a/compiler/typecheck/TcInstDcls.lhs b/compiler/typecheck/TcInstDcls.lhs index 0b4f8b0..ac5c896 100644 --- a/compiler/typecheck/TcInstDcls.lhs +++ b/compiler/typecheck/TcInstDcls.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcInstDecls]{Typechecking instance declarations} + +TcInstDecls: Typechecking instance declarations \begin{code} module TcInstDcls ( tcInstDecls1, tcInstDecls2 ) where @@ -9,56 +11,43 @@ module TcInstDcls ( tcInstDecls1, tcInstDecls2 ) where #include "HsVersions.h" import HsSyn -import TcBinds ( mkPragFun, tcPrags, badBootDeclErr ) -import TcTyClsDecls ( tcIdxTyInstDecl ) -import TcClassDcl ( tcMethodBind, mkMethodBind, badMethodErr, badATErr, - omittedATWarn, tcClassDecl2, getGenericInstances ) +import TcBinds +import TcTyClsDecls +import TcClassDcl import TcRnMonad -import TcMType ( tcSkolSigType, checkValidInstance, - checkValidInstHead ) -import TcType ( TcType, mkClassPred, tcSplitSigmaTy, - tcSplitDFunHead, SkolemInfo(InstSkol), - tcSplitTyConApp, - tcSplitDFunTy, mkFunTy ) -import Inst ( newDictBndr, newDictBndrs, instToId, showLIE, - getOverlapFlag, tcExtendLocalInstEnv ) -import InstEnv ( mkLocalInstance, instanceDFunId ) -import FamInst ( tcExtendLocalFamInstEnv ) -import FamInstEnv ( mkLocalFamInst ) -import TcDeriv ( tcDeriving ) -import TcEnv ( InstInfo(..), InstBindings(..), - newDFunName, tcExtendIdEnv, tcExtendGlobalEnv - ) -import TcHsType ( kcHsSigType, tcHsKindedType ) -import TcUnify ( checkSigTyVars ) -import TcSimplify ( tcSimplifySuperClasses ) -import Type ( zipOpenTvSubst, substTheta, mkTyConApp, mkTyVarTy, - TyThing(ATyCon), isTyVarTy, tcEqType, - substTys, emptyTvSubst, extendTvSubst ) -import Coercion ( mkSymCoercion ) -import TyCon ( TyCon, tyConName, newTyConCo_maybe, tyConTyVars, - isTyConAssoc, tyConFamInst_maybe, tyConDataCons, - assocTyConArgPoss_maybe ) -import DataCon ( classDataCon, dataConInstArgTys ) -import Class ( Class, classTyCon, classBigSig, classATs ) -import Var ( TyVar, Id, idName, idType, tyVarName ) -import MkId ( mkDictFunId ) -import Name ( Name, getSrcLoc, nameOccName ) -import NameSet ( addListToNameSet, emptyNameSet, minusNameSet, - nameSetToList ) -import Maybe ( fromJust, catMaybes ) -import Monad ( when ) -import List ( find ) -import DynFlags ( DynFlag(Opt_WarnMissingMethods) ) -import SrcLoc ( srcLocSpan, unLoc, noLoc, Located(..), srcSpanStart, - getLoc) -import ListSetOps ( minusList ) -import Util ( snocView, dropList ) +import TcMType +import TcType +import Inst +import InstEnv +import FamInst +import FamInstEnv +import TcDeriv +import TcEnv +import TcHsType +import TcUnify +import TcSimplify +import Type +import Coercion +import TyCon +import DataCon +import Class +import Var +import MkId +import Name +import NameSet +import DynFlags +import SrcLoc +import ListSetOps +import Util import Outputable import Bag -import BasicTypes ( Activation( AlwaysActive ), InlineSpec(..) ) -import HscTypes ( implicitTyThings ) +import BasicTypes +import HscTypes import FastString + +import Data.Maybe +import Control.Monad hiding (zipWithM_, mapAndUnzipM) +import Data.List \end{code} Typechecking instance declarations is done in two passes. The first diff --git a/compiler/typecheck/TcMType.lhs b/compiler/typecheck/TcMType.lhs index f01d69d..5fe7db6 100644 --- a/compiler/typecheck/TcMType.lhs +++ b/compiler/typecheck/TcMType.lhs @@ -1,9 +1,12 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section{Monadic type operations} -This module contains monadic operations over types that contain mutable type variables +Monadic type operations + +This module contains monadic operations over types that contain +mutable type variables \begin{code} module TcMType ( @@ -54,60 +57,29 @@ module TcMType ( #include "HsVersions.h" - -- friends: -import TypeRep ( Type(..), PredType(..), -- Friend; can see representation - ThetaType - ) -import TcType ( TcType, TcThetaType, TcTauType, TcPredType, - TcTyVarSet, TcKind, TcTyVar, TcTyVarDetails(..), - MetaDetails(..), SkolemInfo(..), BoxInfo(..), - BoxyTyVar, BoxyType, UserTypeCtxt(..), kindVarRef, - mkKindVar, isMetaTyVar, isSigTyVar, metaTvRef, - tcCmpPred, isClassPred, tcGetTyVar, - tcSplitPhiTy, tcSplitPredTy_maybe, - tcSplitAppTy_maybe, - tcValidInstHeadTy, tcSplitForAllTys, - tcIsTyVarTy, tcSplitSigmaTy, - isUnLiftedType, isIPPred, - typeKind, isSkolemTyVar, - mkAppTy, mkTyVarTy, mkTyVarTys, - tyVarsOfPred, getClassPredTys_maybe, - tyVarsOfType, tyVarsOfTypes, tcView, - pprPred, pprTheta, pprClassPred ) -import Type ( Kind, KindVar, - isLiftedTypeKind, isSubArgTypeKind, isSubOpenTypeKind, - liftedTypeKind, defaultKind - ) -import Type ( TvSubst, zipTopTvSubst, substTy ) -import Coercion ( mkCoKind ) -import Class ( Class, classArity, className ) -import TyCon ( TyCon, isSynTyCon, isUnboxedTupleTyCon, - tyConArity, tyConName ) -import Var ( TyVar, tyVarKind, tyVarName, isTcTyVar, - mkTyVar, mkTcTyVar, tcTyVarDetails, - CoVar, mkCoVar ) - - -- Assertions -#ifdef DEBUG -import TcType ( isFlexi, isBoxyTyVar, isImmutableTyVar ) -import Type ( isSubKind ) -#endif +import TypeRep +import TcType +import Type +import Type +import Coercion +import Class +import TyCon +import Var -- others: import TcRnMonad -- TcType, amongst others -import FunDeps ( grow, checkInstCoverage ) -import Name ( Name, setNameUnique, mkSysTvName ) +import FunDeps +import Name import VarSet -import DynFlags ( dopt, DynFlag(..) ) -import Util ( nOfThem, isSingleton, notNull ) -import ListSetOps ( removeDups ) -import UniqSupply ( uniqsFromSupply ) +import DynFlags +import Util +import ListSetOps +import UniqSupply import Outputable import Control.Monad ( when ) import Data.List ( (\\) ) - \end{code} diff --git a/compiler/typecheck/TcMatches.lhs b/compiler/typecheck/TcMatches.lhs index d9146d9..68e1398 100644 --- a/compiler/typecheck/TcMatches.lhs +++ b/compiler/typecheck/TcMatches.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcMatches]{Typecheck some @Matches@} + +TcMatches: Typecheck some @Matches@ \begin{code} module TcMatches ( tcMatchesFun, tcGRHSsPat, tcMatchesCase, tcMatchLambda, @@ -14,36 +16,24 @@ module TcMatches ( tcMatchesFun, tcGRHSsPat, tcMatchesCase, tcMatchLambda, import {-# SOURCE #-} TcExpr( tcSyntaxOp, tcInferRho, tcMonoExpr, tcPolyExpr ) -import HsSyn ( HsExpr(..), LHsExpr, MatchGroup(..), - Match(..), LMatch, GRHSs(..), GRHS(..), - Stmt(..), LStmt, HsMatchContext(..), - HsStmtContext(..), - pprMatch, isIrrefutableHsPat, mkHsWrap, - mkLHsWrap, pprMatchContext, pprStmtContext, - noSyntaxExpr, matchGroupArity, pprMatches, - HsWrapper ) - +import HsSyn import TcRnMonad -import TcGadt ( Refinement, emptyRefinement, refineResType ) -import Inst ( newMethodFromName ) -import TcEnv ( TcId, tcLookupLocalIds, tcLookupId, tcExtendIdEnv ) -import TcPat ( tcLamPats, tcLamPat ) -import TcMType ( newFlexiTyVarTy, newFlexiTyVarTys ) -import TcType ( TcType, TcRhoType, - BoxySigmaType, BoxyRhoType, - mkFunTys, mkFunTy, mkAppTy, mkTyConApp, - liftedTypeKind ) -import TcBinds ( tcLocalBinds ) -import TcUnify ( boxySplitAppTy, boxySplitTyConApp, boxySplitListTy, - subFunTys, tcSubExp, withBox ) -import TcSimplify ( bindInstsOfLocalFuns ) -import Name ( Name ) -import TysWiredIn ( stringTy, boolTy, parrTyCon, listTyCon, mkListTy, mkPArrTy ) -import PrelNames ( bindMName, returnMName, mfixName, thenMName, failMName ) -import Id ( idType, mkLocalId ) -import TyCon ( TyCon ) +import TcGadt +import Inst +import TcEnv +import TcPat +import TcMType +import TcType +import TcBinds +import TcUnify +import TcSimplify +import Name +import TysWiredIn +import PrelNames +import Id +import TyCon import Outputable -import SrcLoc ( Located(..), getLoc ) +import SrcLoc \end{code} %************************************************************************ diff --git a/compiler/typecheck/TcPat.lhs b/compiler/typecheck/TcPat.lhs index b9099be..6cb177e 100644 --- a/compiler/typecheck/TcPat.lhs +++ b/compiler/typecheck/TcPat.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcPat]{Typechecking patterns} + +TcPat: Typechecking patterns \begin{code} module TcPat ( tcLetPat, tcLamPat, tcLamPats, tcOverloadedLit, @@ -10,58 +12,34 @@ module TcPat ( tcLetPat, tcLamPat, tcLamPats, tcOverloadedLit, #include "HsVersions.h" import {-# SOURCE #-} TcExpr( tcSyntaxOp ) -import HsSyn ( Pat(..), LPat, HsConDetails(..), HsLit(..), - HsOverLit(..), HsExpr(..), HsWrapper(..), - mkCoPat, HsRecField(..), mkRecField, - LHsBinds, emptyLHsBinds, isEmptyLHsBinds, - collectPatsBinders, nlHsLit, - LHsDoc ) -import TcHsSyn ( TcId, hsLitType ) + +import HsSyn +import TcHsSyn import TcRnMonad -import Inst ( InstOrigin(..), shortCutFracLit, shortCutIntLit, - newDictBndrs, instToId, instStupidTheta, isHsVar - ) -import Id ( Id, idType, mkLocalId ) -import Var ( CoVar, tyVarKind ) -import CoreFVs ( idFreeTyVars ) -import Name ( Name, mkSystemVarName ) -import TcSimplify ( tcSimplifyCheck, bindInstsOfLocalFuns ) -import TcEnv ( newLocalName, tcExtendIdEnv1, tcExtendTyVarEnv2, - tcLookupClass, tcLookupDataCon, refineEnvironment, - tcLookupField, tcMetaTy ) -import TcMType ( newFlexiTyVarTy, arityErr, tcInstSkolTyVars, - newCoVars, zonkTcType, tcInstTyVars, newBoxyTyVar ) -import TcType ( TcType, TcTyVar, TcSigmaType, TcRhoType, BoxyType, - SkolemInfo(PatSkol), - BoxySigmaType, BoxyRhoType, argTypeKind, typeKind, - pprSkolTvBinding, isRigidTy, tcTyVarsOfTypes, - zipTopTvSubst, isSubArgTypeKind, isUnboxedTupleType, - mkTyVarTys, mkClassPred, isOverloadedTy, substEqSpec, - mkFunTy, mkFunTys, tidyOpenType, tidyOpenTypes, - mkTyVarTy ) -import VarSet ( elemVarSet ) -import {- Kind parts of -} - Type ( liftedTypeKind ) -import TcUnify ( boxySplitTyConApp, boxySplitListTy, unBox, - zapToMonotype, boxyUnify, boxyUnifyList, - checkSigTyVarsWrt, unifyType ) -import TcHsType ( UserTypeCtxt(..), tcPatSig ) -import TysWiredIn ( boolTy, parrTyCon, tupleTyCon ) -import TcGadt ( Refinement, emptyRefinement, gadtRefine, refineType ) -import Type ( Type, mkTyConApp, substTys, substTheta ) -import StaticFlags ( opt_IrrefutableTuples ) -import TyCon ( TyCon, FieldLabel, tyConFamInst_maybe, - tyConFamilyCoercion_maybe, tyConTyVars ) -import DataCon ( DataCon, dataConTyCon, dataConFullSig, dataConName, - dataConFieldLabels, dataConSourceArity, - dataConStupidTheta, dataConUnivTyVars ) -import PrelNames ( integralClassName, fromIntegerName, integerTyConName, - fromRationalName, rationalTyConName ) -import BasicTypes ( isBoxed ) -import SrcLoc ( Located(..), SrcSpan, noLoc ) -import ErrUtils ( Message ) -import Util ( zipEqual ) -import Maybes ( MaybeErr(..) ) +import Inst +import Id +import Var +import CoreFVs +import Name +import TcSimplify +import TcEnv +import TcMType +import TcType +import VarSet +import TcUnify +import TcHsType +import TysWiredIn +import TcGadt +import Type +import StaticFlags +import TyCon +import DataCon +import PrelNames +import BasicTypes hiding (SuccessFlag(..)) +import SrcLoc +import ErrUtils +import Util +import Maybes import Outputable import FastString \end{code} @@ -191,18 +169,18 @@ tcPatBndr (PS { pat_ctxt = LamPat }) bndr_name pat_ty -- f t = case t of { MkT g -> ... } -- Here, the 'g' must get type (forall a. a->a) from the -- MkT context - ; return (mkLocalId bndr_name pat_ty') } + ; return (Id.mkLocalId bndr_name pat_ty') } tcPatBndr (PS { pat_ctxt = LetPat lookup_sig }) bndr_name pat_ty | Just mono_ty <- lookup_sig bndr_name = do { mono_name <- newLocalName bndr_name ; boxyUnify mono_ty pat_ty - ; return (mkLocalId mono_name mono_ty) } + ; return (Id.mkLocalId mono_name mono_ty) } | otherwise = do { pat_ty' <- unBoxPatBndrType pat_ty bndr_name ; mono_name <- newLocalName bndr_name - ; return (mkLocalId mono_name pat_ty') } + ; return (Id.mkLocalId mono_name pat_ty') } ------------------- diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs index a1592ec..8cb815f 100644 --- a/compiler/typecheck/TcRnDriver.lhs +++ b/compiler/typecheck/TcRnDriver.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[TcModule]{Typechecking a whole module} @@ -24,116 +25,70 @@ import IO import {-# SOURCE #-} TcSplice ( tcSpliceDecls ) #endif -import DynFlags ( DynFlag(..), DynFlags(..), dopt, GhcMode(..) ) -import StaticFlags ( opt_PprStyle_Debug ) -import HsSyn ( HsModule(..), HsExtCore(..), HsGroup(..), LHsDecl, - SpliceDecl(..), HsBind(..), LHsBinds, - emptyRdrGroup, emptyRnGroup, appendGroups, plusHsValBinds, - nlHsApp, nlHsVar, pprLHsBinds, HaddockModInfo(..) ) -import RdrHsSyn ( findSplice ) - -import PrelNames ( runMainIOName, rootMainKey, rOOT_MAIN, mAIN, - main_RDR_Unqual ) -import RdrName ( RdrName, mkRdrUnqual, emptyGlobalRdrEnv ) -import TcHsSyn ( zonkTopDecls ) -import TcExpr ( tcInferRho ) +import DynFlags +import StaticFlags +import HsSyn +import RdrHsSyn + +import PrelNames +import RdrName +import TcHsSyn +import TcExpr import TcRnMonad -import TcType ( tidyTopType, tcEqType ) -import Inst ( showLIE ) -import InstEnv ( extendInstEnvList, Instance, pprInstances, - instanceDFunId ) -import FamInstEnv ( FamInst, pprFamInsts ) -import TcBinds ( tcTopBinds, tcHsBootSigs ) -import TcDefaults ( tcDefaults ) -import TcEnv ( tcExtendGlobalValEnv, iDFunId ) -import TcRules ( tcRules ) -import TcForeign ( tcForeignImports, tcForeignExports ) -import TcInstDcls ( tcInstDecls1, tcInstDecls2 ) -import TcIface ( tcExtCoreBindings, tcHiBootIface ) -import MkIface ( tyThingToIfaceDecl ) +import TcType +import Inst +import InstEnv +import FamInstEnv +import TcBinds +import TcDefaults +import TcEnv +import TcRules +import TcForeign +import TcInstDcls +import TcIface +import MkIface import IfaceSyn -import TcSimplify ( tcSimplifyTop ) -import TcTyClsDecls ( tcTyAndClassDecls ) -import LoadIface ( loadOrphanModules ) -import RnNames ( importsFromLocalDecls, rnImports, rnExports, - reportUnusedNames, reportDeprecations ) -import RnEnv ( lookupSrcOcc_maybe ) -import RnSource ( rnSrcDecls, rnTyClDecls, checkModDeprec ) -import RnHsDoc ( rnMbHsDoc ) -import PprCore ( pprRules, pprCoreBindings ) -import CoreSyn ( CoreRule, bindersOfBinds ) -import ErrUtils ( Messages, mkDumpDoc, showPass ) -import Id ( Id, mkExportedLocalId, isLocalId, idName, idType ) -import Var ( Var ) +import TcSimplify +import TcTyClsDecls +import LoadIface +import RnNames +import RnEnv +import RnSource +import RnHsDoc +import PprCore +import CoreSyn +import ErrUtils +import Id +import Var import Module -import UniqFM ( elemUFM, eltsUFM ) -import OccName ( mkVarOccFS, plusOccEnv ) -import Name ( Name, NamedThing(..), isExternalName, getSrcLoc, isWiredInName, - nameModule, nameOccName, mkExternalName ) +import UniqFM +import Name import NameSet import NameEnv -import TyCon ( tyConHasGenerics ) -import SrcLoc ( srcLocSpan, Located(..), noLoc ) -import DriverPhases ( HscSource(..), isHsBoot ) -import HscTypes ( ModGuts(..), ModDetails(..), emptyModDetails, - HscEnv(..), ExternalPackageState(..), - IsBootInterface, noDependencies, - Deprecs( NoDeprecs ), plusDeprecs, - ForeignStubs(NoStubs), availsToNameSet, - TypeEnv, lookupTypeEnv, hptInstances, - extendTypeEnvWithIds, typeEnvIds, typeEnvTyCons, typeEnvElts, - emptyFixityEnv, GenAvailInfo(..) - ) +import TyCon +import SrcLoc +import HscTypes import Outputable #ifdef GHCI -import HsSyn ( HsStmtContext(..), Stmt(..), HsExpr(..), - HsLocalBinds(..), HsValBinds(..), - LStmt, LHsExpr, LHsType, mkMatch, emptyLocalBinds, - collectLStmtsBinders, collectLStmtBinders, nlVarPat, - mkFunBind, placeHolderType, noSyntaxExpr, nlHsTyApp ) -import RdrName ( GlobalRdrElt(..), globalRdrEnvElts, - unQualOK, lookupLocalRdrEnv, extendLocalRdrEnv ) -import RnSource ( addTcgDUs ) -import TcHsSyn ( mkHsDictLet, zonkTopLExpr, zonkTopBndrs ) -import TcHsType ( kcHsType ) -import TcMType ( zonkTcType, zonkQuantifiedTyVar ) -import TcMatches ( tcStmts, tcDoStmt ) -import TcSimplify ( tcSimplifyInteractive, tcSimplifyInfer ) -import TcGadt ( emptyRefinement ) -import TcType ( Type, mkForAllTys, mkFunTys, mkTyConApp, tyVarsOfType, isTauTy, - isUnLiftedType, tyClsNamesOfDFunHead, tyClsNamesOfType, isUnitTy ) -import TcEnv ( tcLookupTyCon, tcLookupId, tcLookupGlobal ) -import TypeRep ( TyThing(..) ) -import RnTypes ( rnLHsType ) -import Inst ( tcGetInstEnvs ) -import InstEnv ( classInstances, instEnvElts ) -import RnExpr ( rnStmts, rnLExpr ) -import LoadIface ( loadSysInterface ) -import IfaceEnv ( ifaceExportNames ) -import RnEnv ( lookupOccRn, dataTcOccs, lookupFixityRn ) -import Id ( setIdType ) -import MkId ( unsafeCoerceId ) -import TyCon ( tyConName ) -import TysWiredIn ( mkListTy, unitTy ) -import IdInfo ( GlobalIdDetails(..) ) -import {- Kind parts of -} Type ( Kind ) -import Var ( globaliseId ) -import Name ( isBuiltInSyntax, isInternalName ) -import OccName ( isTcOcc ) -import PrelNames ( iNTERACTIVE, ioTyConName, printName, itName, - bindIOName, thenIOName, returnIOName ) -import HscTypes ( InteractiveContext(..), - ModIface(..), icPrintUnqual, - Dependencies(..) ) -import BasicTypes ( Fixity, RecFlag(..) ) -import SrcLoc ( unLoc ) -import Data.Maybe ( isNothing ) +import TcHsType +import TcMType +import TcMatches +import TcGadt +import RnTypes +import RnExpr +import IfaceEnv +import MkId +import TysWiredIn +import IdInfo +import {- Kind parts of -} Type +import BasicTypes +import Data.Maybe #endif -import FastString ( mkFastString ) -import Util ( sortLe ) -import Bag ( unionBags, snocBag, emptyBag, unitBag, unionManyBags ) +import FastString +import Util +import Bag import Control.Monad ( unless ) import Data.Maybe ( isJust ) @@ -576,7 +531,7 @@ checkHiBootIface where boot_dfun = instanceDFunId boot_inst boot_inst_ty = idType boot_dfun - local_boot_dfun = mkExportedLocalId (idName boot_dfun) boot_inst_ty + local_boot_dfun = Id.mkExportedLocalId (idName boot_dfun) boot_inst_ty ---------------- missingBootThing thing @@ -783,7 +738,7 @@ check_main ghc_mode tcg_env main_mod main_fn ; let { root_main_name = mkExternalName rootMainKey rOOT_MAIN (mkVarOccFS FSLIT("main")) (getSrcLoc main_name) - ; root_main_id = mkExportedLocalId root_main_name ty + ; root_main_id = Id.mkExportedLocalId root_main_name ty ; main_bind = noLoc (VarBind root_main_id main_expr) } ; return (tcg_env { tcg_binds = tcg_binds tcg_env @@ -925,7 +880,7 @@ tcRnStmt hsc_env ictxt rdr_stmt globaliseAndTidy :: Id -> Id globaliseAndTidy id -- Give the Id a Global Name, and tidy its type - = setIdType (globaliseId VanillaGlobal id) tidy_type + = Id.setIdType (globaliseId VanillaGlobal id) tidy_type where tidy_type = tidyTopType (idType id) \end{code} @@ -1135,11 +1090,11 @@ tcRnType hsc_env ictxt rdr_type -- a package module with an interface on disk. If neither of these is -- true, then the result will be an error indicating the interface -- could not be found. -getModuleExports :: HscEnv -> Module -> IO (Messages, Maybe NameSet) +getModuleExports :: HscEnv -> Module -> IO (Messages, Maybe [AvailInfo]) getModuleExports hsc_env mod = initTc hsc_env HsSrcFile iNTERACTIVE (tcGetModuleExports mod) -tcGetModuleExports :: Module -> TcM NameSet +tcGetModuleExports :: Module -> TcM [AvailInfo] tcGetModuleExports mod = do let doc = ptext SLIT("context for compiling statements") iface <- initIfaceTcRn $ loadSysInterface doc mod diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs index b14cab5..fff5404 100644 --- a/compiler/typecheck/TcRnTypes.lhs +++ b/compiler/typecheck/TcRnTypes.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP Project, Glasgow University, 1992-2002 % \begin{code} @@ -41,40 +42,34 @@ module TcRnTypes( #include "HsVersions.h" -import HsSyn ( PendingSplice, HsOverLit, LRuleDecl, LForeignDecl, - ArithSeqInfo, DictBinds, LHsBinds, LImportDecl, HsGroup, - HsWrapper, IE, HsDoc, HaddockModInfo ) -import HscTypes ( FixityEnv, - HscEnv, TypeEnv, TyThing, - GenAvailInfo(..), AvailInfo, HscSource(..), - availName, IsBootInterface, Deprecations ) -import Packages ( PackageId ) -import Type ( Type, pprTyThingCategory ) -import TcType ( TcTyVarSet, TcType, TcThetaType, SkolemInfo, - TcPredType, TcKind, tcCmpPred, tcCmpType, - tcCmpTypes, pprSkolInfo ) -import InstEnv ( Instance, InstEnv ) -import FamInstEnv ( FamInst, FamInstEnv ) +import HsSyn hiding (LIE) +import HscTypes +import Packages +import Type +import TcType +import InstEnv +import FamInstEnv import IOEnv -import RdrName ( GlobalRdrEnv, LocalRdrEnv ) -import Name ( Name ) +import RdrName +import Name import NameEnv -import NameSet ( NameSet, unionNameSets, DefUses ) -import Var ( Id, TyVar ) -import VarEnv ( TidyEnv ) +import NameSet +import Var +import VarEnv import Module import UniqFM -import SrcLoc ( SrcSpan, SrcLoc, Located, srcSpanStart ) -import VarSet ( IdSet ) -import ErrUtils ( Messages, Message ) -import UniqSupply ( UniqSupply ) -import BasicTypes ( IPName ) -import Util ( thenCmp ) +import SrcLoc +import VarSet +import ErrUtils +import UniqSupply +import BasicTypes +import Util import Bag import Outputable -import Maybe ( mapMaybe ) -import ListSetOps ( unionLists ) -import Data.List ( nub ) +import ListSetOps + +import Data.Maybe +import Data.List \end{code} diff --git a/compiler/typecheck/TcRules.lhs b/compiler/typecheck/TcRules.lhs index c7e951f..ef8e388 100644 --- a/compiler/typecheck/TcRules.lhs +++ b/compiler/typecheck/TcRules.lhs @@ -1,25 +1,27 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1993-1998 % -\section[TcRules]{Typechecking transformation rules} + +TcRules: Typechecking transformation rules \begin{code} module TcRules ( tcRules ) where #include "HsVersions.h" -import HsSyn ( RuleDecl(..), LRuleDecl, RuleBndr(..), mkHsDictLet ) +import HsSyn import TcRnMonad -import TcSimplify ( tcSimplifyRuleLhs, tcSimplifyInferCheck ) -import TcMType ( newFlexiTyVarTy, zonkQuantifiedTyVar, tcSkolSigTyVars ) -import TcType ( tyVarsOfTypes, openTypeKind, SkolemInfo(..), substTyWith, mkTyVarTys ) -import TcHsType ( UserTypeCtxt(..), tcHsPatSigType ) -import TcExpr ( tcMonoExpr ) -import TcEnv ( tcExtendIdEnv, tcExtendTyVarEnv ) -import Inst ( instToId ) -import Id ( idType, mkLocalId ) -import Name ( Name ) -import SrcLoc ( noLoc, unLoc ) +import TcSimplify +import TcMType +import TcType +import TcHsType +import TcExpr +import TcEnv +import Inst +import Id +import Name +import SrcLoc import Outputable \end{code} diff --git a/compiler/typecheck/TcSimplify.lhs b/compiler/typecheck/TcSimplify.lhs index ffd88b8..247df7d 100644 --- a/compiler/typecheck/TcSimplify.lhs +++ b/compiler/typecheck/TcSimplify.lhs @@ -1,9 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcSimplify]{TcSimplify} - +TcSimplify \begin{code} module TcSimplify ( @@ -21,58 +21,39 @@ module TcSimplify ( #include "HsVersions.h" import {-# SOURCE #-} TcUnify( unifyType ) -import HsSyn ( HsBind(..), HsExpr(..), LHsExpr, mkWpTyApps, - HsWrapper(..), (<.>), emptyLHsBinds ) +import HsSyn import TcRnMonad -import Inst ( lookupInst, LookupInstResult(..), - tyVarsOfInst, fdPredsOfInsts, - isDict, isClassDict, - isMethodFor, isMethod, - instToId, tyVarsOfInsts, - ipNamesOfInsts, ipNamesOfInst, dictPred, - fdPredsOfInst, - newDictBndrs, newDictBndrsO, - getDictClassTys, isTyVarDict, instLoc, - zonkInst, tidyInsts, tidyMoreInsts, - pprInsts, pprDictsInFull, pprInstInFull, tcGetInstEnvs, - isInheritableInst, pprDictsTheta - ) -import TcEnv ( tcGetGlobalTyVars, findGlobals, pprBinders, - lclEnvElts, tcMetaTy ) -import InstEnv ( lookupInstEnv, classInstances, pprInstances ) -import TcMType ( zonkTcTyVarsAndFV, tcInstTyVars, zonkTcPredType ) -import TcType ( TcTyVar, TcTyVarSet, ThetaType, TcPredType, tidyPred, - mkClassPred, isOverloadedTy, isSkolemTyVar, - mkTyVarTy, tcGetTyVar, isTyVarClassPred, mkTyVarTys, - tyVarsOfPred, tcEqType, pprPred, mkPredTy, tcIsTyVarTy ) -import TcIface ( checkWiredInTyCon ) -import Id ( idType ) -import Var ( TyVar ) -import TyCon ( TyCon ) -import Name ( Name ) -import NameSet ( NameSet, mkNameSet, elemNameSet ) -import Class ( classBigSig, classKey ) -import FunDeps ( oclose, grow, improve, pprEquation ) -import PrelInfo ( isNumericClass, isStandardClass ) -import PrelNames ( integerTyConName, - showClassKey, eqClassKey, ordClassKey ) -import Type ( zipTopTvSubst, substTheta, substTy ) -import TysWiredIn ( doubleTy, doubleTyCon ) -import ErrUtils ( Message ) -import BasicTypes ( TopLevelFlag, isNotTopLevel ) +import Inst +import TcEnv +import InstEnv +import TcMType +import TcType +import TcIface +import Id +import Var +import TyCon +import Name +import NameSet +import Class +import FunDeps +import PrelInfo +import PrelNames +import Type +import TysWiredIn +import ErrUtils +import BasicTypes import VarSet -import VarEnv ( TidyEnv ) +import VarEnv import FiniteMap import Bag import Outputable -import ListSetOps ( equivClasses ) -import Util ( zipEqual, isSingleton ) -import List ( partition ) -import SrcLoc ( Located(..) ) -import DynFlags ( DynFlags(ctxtStkDepth), - DynFlag( Opt_GlasgowExts, Opt_AllowUndecidableInstances, - Opt_WarnTypeDefaults, Opt_ExtendedDefaultRules ) ) +import ListSetOps +import Util +import SrcLoc +import DynFlags + +import Data.List \end{code} diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs index 455cfa0..b71294f 100644 --- a/compiler/typecheck/TcSplice.lhs +++ b/compiler/typecheck/TcSplice.lhs @@ -1,77 +1,68 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TcSplice]{Template Haskell splices} + +TcSplice: Template Haskell splices \begin{code} module TcSplice( tcSpliceExpr, tcSpliceDecls, tcBracket ) where #include "HsVersions.h" -import HscMain ( compileExpr ) -import TcRnDriver ( tcTopSrcDecls ) +import HscMain +import TcRnDriver -- These imports are the reason that TcSplice -- is very high up the module hierarchy +import HsSyn +import Convert +import RnExpr +import RnEnv +import RdrName +import RnTypes +import TcExpr +import TcHsSyn +import TcSimplify +import TcUnify +import TcType +import TcEnv +import TcMType +import TcHsType +import TcIface +import TypeRep +import Name +import NameEnv +import HscTypes +import OccName +import Var +import Module +import TcRnMonad +import IfaceEnv +import Class +import TyCon +import DataCon +import Id +import IdInfo +import TysWiredIn +import DsMeta +import DsExpr +import DsMonad hiding (Splice) +import ErrUtils +import SrcLoc +import Outputable +import Unique +import PackageConfig +import BasicTypes +import Panic +import FastString + import qualified Language.Haskell.TH as TH -- THSyntax gives access to internal functions and data types import qualified Language.Haskell.TH.Syntax as TH -import HsSyn ( HsBracket(..), HsExpr(..), HsSplice(..), LHsExpr, LHsDecl, - HsType, LHsType ) -import Convert ( convertToHsExpr, convertToHsDecls, convertToHsType, thRdrName ) -import RnExpr ( rnLExpr ) -import RnEnv ( lookupFixityRn, lookupSrcOcc_maybe, lookupImportedName ) -import RdrName ( RdrName, lookupLocalRdrEnv, isSrcRdrName ) -import RnTypes ( rnLHsType ) -import TcExpr ( tcMonoExpr ) -import TcHsSyn ( mkHsDictLet, zonkTopLExpr ) -import TcSimplify ( tcSimplifyTop, tcSimplifyBracket ) -import TcUnify ( boxyUnify, unBox ) -import TcType ( TcType, TcKind, BoxyRhoType, liftedTypeKind, mkAppTy, tcSplitSigmaTy ) -import TcEnv ( spliceOK, tcMetaTy, bracketOK ) -import TcMType ( newFlexiTyVarTy, newKindVar, UserTypeCtxt(ExprSigCtxt), zonkTcType ) -import TcHsType ( tcHsSigType, kcHsType ) -import TcIface ( tcImportDecl ) -import TypeRep ( Type(..), PredType(..), TyThing(..) ) -- For reification -import PrelNames ( thFAKE ) -import Name ( Name, NamedThing(..), nameOccName, nameModule, isExternalName, - nameIsLocalOrFrom ) -import NameEnv ( lookupNameEnv ) -import HscTypes ( lookupType, ExternalPackageState(..), emptyModDetails ) -import OccName -import Var ( Id, TyVar, idType ) -import Module ( moduleName, moduleNameString, modulePackageId ) -import TcRnMonad -import IfaceEnv ( lookupOrig ) -import Class ( Class, classExtraBigSig ) -import TyCon ( TyCon, tyConTyVars, synTyConDefn, - isSynTyCon, isNewTyCon, tyConDataCons, isPrimTyCon, isFunTyCon, - tyConArity, tyConStupidTheta, isUnLiftedTyCon ) -import DataCon ( DataCon, dataConTyCon, dataConOrigArgTys, dataConStrictMarks, - dataConName, dataConFieldLabels, dataConWrapId, dataConIsInfix, - isVanillaDataCon ) -import Id ( idName, globalIdDetails ) -import IdInfo ( GlobalIdDetails(..) ) -import TysWiredIn ( mkListTy ) -import DsMeta ( expQTyConName, typeQTyConName, decTyConName, qTyConName, nameTyConName ) -import DsExpr ( dsLExpr ) -import DsMonad ( initDsTc ) -import ErrUtils ( Message ) -import SrcLoc ( SrcSpan, noLoc, unLoc, getLoc ) -import Outputable -import Unique ( Unique, Uniquable(..), getKey, mkUniqueGrimily ) -import PackageConfig ( packageIdString ) -import BasicTypes ( StrictnessMark(..), Fixity(..), FixityDirection(..) ) -import Panic ( showException ) -import FastString ( LitString ) - -import GHC.Base ( unsafeCoerce#, Int#, Int(..) ) -- Should have a better home in the module hierarchy -import Monad ( liftM ) - -#ifdef GHCI -import FastString ( mkFastString ) -#endif +import GHC.Exts ( unsafeCoerce#, Int#, Int(..) ) +import Control.Monad ( liftM ) \end{code} diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs index eee2041..8ab053e 100644 --- a/compiler/typecheck/TcTyClsDecls.lhs +++ b/compiler/typecheck/TcTyClsDecls.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1996-1998 % -\section[TcTyClsDecls]{Typecheck type and class declarations} + +TcTyClsDecls: Typecheck type and class declarations \begin{code} module TcTyClsDecls ( @@ -10,70 +12,38 @@ module TcTyClsDecls ( #include "HsVersions.h" -import HsSyn ( TyClDecl(..), HsConDetails(..), HsTyVarBndr(..), - ConDecl(..), HsRecField(..), Sig(..), NewOrData(..), ResType(..), - tyClDeclTyVars, isSynDecl, isIdxTyDecl, - isKindSigDecl, hsConArgs, LTyClDecl, tcdName, - hsTyVarName, LHsTyVarBndr, LHsType - ) -import HsTypes ( HsBang(..), getBangStrictness, hsLTyVarNames ) -import BasicTypes ( RecFlag(..), StrictnessMark(..) ) -import HscTypes ( implicitTyThings, ModDetails ) -import BuildTyCl ( buildClass, buildAlgTyCon, buildSynTyCon, buildDataCon, - mkDataTyConRhs, mkNewTyConRhs ) +import HsSyn +import HsTypes +import BasicTypes +import HscTypes +import BuildTyCl import TcRnMonad -import TcEnv ( TyThing(..), - tcLookupLocated, tcLookupLocatedGlobal, - tcExtendGlobalEnv, tcExtendKindEnv, - tcExtendKindEnvTvs, newFamInstTyConName, - tcExtendRecEnv, tcLookupTyVar, tcLookupLocatedTyCon ) -import TcTyDecls ( calcRecFlags, calcClassCycles, calcSynCycles ) -import TcClassDcl ( tcClassSigs, tcAddDeclCtxt ) -import TcHsType ( kcHsTyVars, kcHsLiftedSigType, kcHsType, - kcHsContext, tcTyVarBndrs, tcHsKindedType, tcHsKindedContext, - kcHsSigType, tcHsBangType, tcLHsConResTy, - tcDataKindSig, kcCheckHsType ) -import TcMType ( newKindVar, checkValidTheta, checkValidType, - -- checkFreeness, - UserTypeCtxt(..), SourceTyCtxt(..) ) -import TcType ( TcKind, TcType, Type, tyVarsOfType, mkPhiTy, - mkArrowKind, liftedTypeKind, - tcSplitSigmaTy, tcGetTyVar_maybe ) -import Type ( splitTyConApp_maybe, - newTyConInstRhs, isLiftedTypeKind, Kind, - splitKindFunTys, mkArrowKinds - -- pprParendType, pprThetaArrow - ) -import Generics ( validGenericMethodType, canDoGenerics ) -import Class ( Class, className, classTyCon, DefMeth(..), classBigSig, classTyVars ) -import TyCon ( TyCon, AlgTyConRhs( AbstractTyCon, OpenDataTyCon, - OpenNewTyCon ), - SynTyConRhs( OpenSynTyCon, SynonymTyCon ), - tyConDataCons, mkForeignTyCon, isProductTyCon, - isRecursiveTyCon, - tyConStupidTheta, synTyConRhs, isSynTyCon, tyConName, - isNewTyCon, isDataTyCon, tyConKind, - setTyConArgPoss ) -import DataCon ( DataCon, dataConUserType, dataConName, - dataConFieldLabels, dataConTyCon, dataConAllTyVars, - dataConFieldType, dataConResTys ) -import Var ( TyVar, idType, idName, tyVarName, setTyVarName ) -import VarSet ( elemVarSet, mkVarSet ) -import Name ( Name, getSrcLoc, tidyNameOcc, getOccName ) -import OccName ( initTidyOccEnv, tidyOccName ) +import TcEnv +import TcTyDecls +import TcClassDcl +import TcHsType +import TcMType +import TcType +import Type +import Generics +import Class +import TyCon +import DataCon +import Var +import VarSet +import Name +import OccName import Outputable -import Maybe ( isJust, fromJust, isNothing, catMaybes ) -import Maybes ( expectJust ) -import Monad ( unless ) -import Unify ( tcMatchTys, tcMatchTyX ) -import Util ( zipLazy, isSingleton, notNull, sortLe, mapAccumL ) -import List ( partition, elemIndex ) -import SrcLoc ( Located(..), unLoc, getLoc, srcLocSpan, - srcSpanStart ) -import ListSetOps ( equivClasses, minusList ) -import Digraph ( SCC(..) ) -import DynFlags ( DynFlag( Opt_GlasgowExts, Opt_Generics, - Opt_UnboxStrictFields, Opt_IndexedTypes ) ) +import Maybes +import Monad +import Unify +import Util +import SrcLoc +import ListSetOps +import Digraph +import DynFlags + +import Data.List ( partition, elemIndex ) \end{code} @@ -380,7 +350,7 @@ kcIdxTyPats decl thing_inside -- type functions can have a higher-kinded result ; let resultKind = mkArrowKinds (drop (length hs_typats) kinds) resKind - ; typats <- zipWithM kcCheckHsType hs_typats kinds + ; typats <- TcRnMonad.zipWithM kcCheckHsType hs_typats kinds ; thing_inside tvs typats resultKind family } where diff --git a/compiler/typecheck/TcTyDecls.lhs b/compiler/typecheck/TcTyDecls.lhs index 04602ac..c1a3389 100644 --- a/compiler/typecheck/TcTyDecls.lhs +++ b/compiler/typecheck/TcTyDecls.lhs @@ -8,7 +8,6 @@ Analysis functions over data types. Specficially, detecting recursive types. This stuff is only used for source-code decls; it's recorded in interface files for imported data types. - \begin{code} module TcTyDecls( calcRecFlags, diff --git a/compiler/typecheck/TcType.lhs b/compiler/typecheck/TcType.lhs index cb1c68b..aa0b0c9 100644 --- a/compiler/typecheck/TcType.lhs +++ b/compiler/typecheck/TcType.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[TcType]{Types used in the typechecker} @@ -129,34 +130,32 @@ module TcType ( #include "HsVersions.h" -- friends: -import TypeRep ( Type(..), funTyCon, Kind ) -- friend - -import Type -import TyCon ( TyCon, isUnLiftedTyCon, isSynTyCon, isOpenTyCon, - synTyConDefn, tyConUnique ) -import DataCon ( DataCon, dataConStupidTheta, dataConResTys ) -import Class ( Class ) -import Var ( TyVar, Id, isCoVar, isTcTyVar, mkTcTyVar, tyVarName, tyVarKind, tcTyVarDetails ) -import ForeignCall ( Safety, DNType(..) ) -import Unify ( tcMatchTys ) +import TypeRep +import DataCon +import Class +import Var +import ForeignCall +import Unify import VarSet +import Type +import TyCon -- others: -import DynFlags ( DynFlags, DynFlag( Opt_GlasgowExts ), dopt ) -import Name ( Name, NamedThing(..), mkInternalName, getSrcLoc, mkSystemName ) +import DynFlags +import Name import NameSet -import VarEnv ( TidyEnv ) -import OccName ( OccName, mkDictOcc, mkOccName, tvName ) -import PrelNames -- Lots (e.g. in isFFIArgumentTy) -import TysWiredIn ( unitTyCon, charTyCon, listTyCon ) -import BasicTypes ( Arity, ipNameName ) -import SrcLoc ( SrcLoc, SrcSpan ) -import Util ( equalLength ) -import Maybes ( maybeToBool, expectJust, mapCatMaybes ) -import ListSetOps ( hasNoDups ) -import List ( nubBy ) +import VarEnv +import OccName +import PrelNames +import TysWiredIn +import BasicTypes +import SrcLoc +import Util +import Maybes +import ListSetOps import Outputable +import Data.List import Data.IORef \end{code} diff --git a/compiler/typecheck/TcUnify.lhs b/compiler/typecheck/TcUnify.lhs index e9f0301..03c1bb2 100644 --- a/compiler/typecheck/TcUnify.lhs +++ b/compiler/typecheck/TcUnify.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section{Type subsumption and unification} + +Type subsumption and unification \begin{code} module TcUnify ( @@ -25,61 +27,30 @@ module TcUnify ( #include "HsVersions.h" -import HsSyn ( HsWrapper(..), idHsWrapper, isIdHsWrapper, (<.>), - mkWpLams, mkWpTyLams, mkWpApps ) -import TypeRep ( Type(..), PredType(..) ) - -import TcMType ( lookupTcTyVar, LookupTyVarResult(..), - tcInstBoxyTyVar, newKindVar, newMetaTyVar, - newBoxyTyVar, newBoxyTyVarTys, readFilledBox, - readMetaTyVar, writeMetaTyVar, newFlexiTyVarTy, - tcInstSkolTyVars, tcInstTyVar, tcInstSkolType, - zonkTcKind, zonkType, zonkTcType, zonkTcTyVarsAndFV, - readKindVar, writeKindVar ) -import TcSimplify ( tcSimplifyCheck ) -import TcEnv ( tcGetGlobalTyVars, findGlobals ) -import TcIface ( checkWiredInTyCon ) +import HsSyn +import TypeRep + +import TcMType +import TcSimplify +import TcEnv +import TcIface import TcRnMonad -- TcType, amongst others -import TcType ( TcKind, TcType, TcTyVar, BoxyTyVar, TcTauType, - BoxySigmaType, BoxyRhoType, BoxyType, - TcTyVarSet, TcThetaType, TcTyVarDetails(..), BoxInfo(..), - SkolemInfo( GenSkol, UnkSkol ), MetaDetails(..), isImmutableTyVar, - pprSkolTvBinding, isTauTy, isTauTyCon, isSigmaTy, - mkFunTy, mkFunTys, mkTyConApp, isMetaTyVar, - tcSplitForAllTys, tcSplitAppTy_maybe, tcSplitFunTys, mkTyVarTys, - tcSplitSigmaTy, tyVarsOfType, mkPhiTy, mkTyVarTy, mkPredTy, - typeKind, mkForAllTys, mkAppTy, isBoxyTyVar, - tcView, exactTyVarsOfType, - tidyOpenType, tidyOpenTyVar, tidyOpenTyVars, - pprType, tidyKind, tidySkolemTyVar, isSkolemTyVar, isSigTyVar, - TvSubst, mkTvSubst, zipTyEnv, zipOpenTvSubst, emptyTvSubst, - substTy, substTheta, - lookupTyVar, extendTvSubst ) -import Type ( Kind, SimpleKind, KindVar, - openTypeKind, liftedTypeKind, unliftedTypeKind, - mkArrowKind, defaultKind, - argTypeKind, isLiftedTypeKind, isUnliftedTypeKind, - isSubKind, pprKind, splitKindFunTys, isSubKindCon, - isOpenTypeKind, isArgTypeKind ) -import TysPrim ( alphaTy, betaTy ) -import Inst ( newDictBndrsO, instCall, instToId ) -import TyCon ( TyCon, tyConArity, tyConTyVars, isSynTyCon ) -import TysWiredIn ( listTyCon ) -import Id ( Id ) -import Var ( Var, varName, tyVarKind, isTcTyVar, tcTyVarDetails ) +import TcType +import Type +import TysPrim +import Inst +import TyCon +import TysWiredIn +import Id +import Var import VarSet import VarEnv -import Name ( Name, isSystemName ) -import ErrUtils ( Message ) -import Maybes ( expectJust, isNothing ) -import BasicTypes ( Arity ) -import Util ( notNull, equalLength ) +import Name +import ErrUtils +import Maybes +import BasicTypes +import Util import Outputable - --- Assertion imports -#ifdef DEBUG -import TcType ( isBoxyTy, isFlexi ) -#endif \end{code} %************************************************************************ @@ -1261,7 +1232,7 @@ uUnfilledVars outer swapped tv1 (MetaTv info1 ref1) tv2 (MetaTv info2 ref2) k1_sub_k2 = k1 `isSubKind` k2 k2_sub_k1 = k2 `isSubKind` k1 - nicer_to_update_tv1 = isSystemName (varName tv1) + nicer_to_update_tv1 = isSystemName (Var.varName tv1) -- Try to update sys-y type variables in preference to ones -- gotten (say) by instantiating a polymorphic function with -- a user-written type sig diff --git a/compiler/types/Class.lhs b/compiler/types/Class.lhs index abf7e4b..56d28ac 100644 --- a/compiler/types/Class.lhs +++ b/compiler/types/Class.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[Class]{The @Class@ datatype} + +The @Class@ datatype \begin{code} module Class ( @@ -20,10 +22,10 @@ module Class ( import {-# SOURCE #-} TyCon ( TyCon ) import {-# SOURCE #-} TypeRep ( PredType ) -import Var ( Id, TyVar ) -import Name ( NamedThing(..), Name ) -import BasicTypes ( Arity ) -import Unique ( Unique, Uniquable(..) ) +import Var +import Name +import BasicTypes +import Unique import Outputable \end{code} diff --git a/compiler/types/Coercion.lhs b/compiler/types/Coercion.lhs index ca1b1a6..672deae 100644 --- a/compiler/types/Coercion.lhs +++ b/compiler/types/Coercion.lhs @@ -1,5 +1,8 @@ +% +% (c) The University of Glasgow 2006 +% - Module for type coercions, as in System FC. +Module for type coercions, as in System FC. Coercions are represented as types, and their kinds tell what types the coercion works on. @@ -34,29 +37,18 @@ module Coercion ( #include "HsVersions.h" import TypeRep -import Type ( Type, Kind, PredType, substTyWith, mkAppTy, mkForAllTy, - mkFunTy, splitAppTy_maybe, splitForAllTy_maybe, coreView, - kindView, mkTyConApp, isCoercionKind, isEqPred, mkAppTys, - coreEqType, splitAppTys, isTyVarTy, splitTyConApp_maybe - ) -import TyCon ( TyCon, tyConArity, mkCoercionTyCon, isClosedNewTyCon, - newTyConRhs, newTyConCo_maybe, - isCoercionTyCon, isCoercionTyCon_maybe ) -import Var ( Var, TyVar, isTyVar, tyVarKind ) -import Name ( BuiltInSyntax(..), Name, mkWiredInName, tcName ) -import OccName ( mkOccNameFS ) -import PrelNames ( symCoercionTyConKey, - transCoercionTyConKey, leftCoercionTyConKey, - rightCoercionTyConKey, instCoercionTyConKey, - unsafeCoercionTyConKey, gHC_PRIM - ) -import Util ( lengthIs, snocView ) -import Unique ( hasKey ) -import BasicTypes ( Arity ) +import Type +import TyCon +import Var hiding (isCoVar) +import Name +import OccName +import PrelNames +import Util +import Unique +import BasicTypes import Outputable - ------------------------------ decomposeCo :: Arity -> Coercion -> [Coercion] -- (decomposeCo 3 c) = [right (left (left c)), right (left c), right c] diff --git a/compiler/types/FamInstEnv.lhs b/compiler/types/FamInstEnv.lhs index acc0960..c44c200 100644 --- a/compiler/types/FamInstEnv.lhs +++ b/compiler/types/FamInstEnv.lhs @@ -1,4 +1,8 @@ -\section[FamInstEnv]{Type checked family instance declarations} +% +% (c) The University of Glasgow 2006 +% + +FamInstEnv: Type checked family instance declarations \begin{code} module FamInstEnv ( @@ -12,22 +16,21 @@ module FamInstEnv ( #include "HsVersions.h" -import InstEnv ( roughMatchTcs, instanceCantMatch ) -import Unify ( tcMatchTys ) -import TcType ( Type ) -import Type ( TvSubst, TyThing (ATyCon), pprParendType ) -import TyCon ( TyCon, isDataTyCon, isNewTyCon, isSynTyCon, - tyConName, tyConTyVars, tyConFamInst_maybe ) -import VarSet ( TyVarSet, mkVarSet ) -import Var ( TyVar ) -import Name ( Name, getOccName, NamedThing(..), getSrcLoc ) -import OccName ( parenSymOcc ) -import SrcLoc ( pprDefnLoc ) -import UniqFM ( UniqFM, lookupUFM, emptyUFM, addToUFM_C, eltsUFM ) +import InstEnv +import Unify +import TcType +import Type +import TyCon +import VarSet +import Var +import Name +import OccName +import SrcLoc +import UniqFM import Outputable -import Maybe ( isJust, isNothing ) -import Monad ( mzero ) +import Maybe +import Monad \end{code} diff --git a/compiler/types/FunDeps.lhs b/compiler/types/FunDeps.lhs index 5ece047..06248b7 100644 --- a/compiler/types/FunDeps.lhs +++ b/compiler/types/FunDeps.lhs @@ -1,7 +1,9 @@ - +% +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 2000 % -\section[FunDeps]{FunDeps - functional dependencies} + +FunDeps - functional dependencies It's better to read it as: "if we know these, then we're going to know these" @@ -15,23 +17,22 @@ module FunDeps ( #include "HsVersions.h" -import Name ( Name, getSrcLoc ) -import Var ( TyVar ) -import Class ( Class, FunDep, pprFundeps, classTvsFds ) -import TcGadt ( tcUnifyTys, BindFlag(..) ) -import Type ( substTys, notElemTvSubst ) -import Coercion ( isEqPred ) -import TcType ( Type, PredType(..), tcEqType, - predTyUnique, mkClassPred, tyVarsOfTypes, tyVarsOfPred ) -import InstEnv ( Instance(..), InstEnv, instanceHead, classInstances, - instanceCantMatch, roughMatchTcs ) +import Name +import Var +import Class +import TcGadt +import Type +import Coercion +import TcType +import InstEnv import VarSet import VarEnv import Outputable -import Util ( notNull ) -import List ( tails ) -import Maybe ( isJust ) -import ListSetOps ( equivClassesByUniq ) +import Util +import ListSetOps + +import Data.List ( tails ) +import Data.Maybe ( isJust ) \end{code} diff --git a/compiler/types/Generics.lhs b/compiler/types/Generics.lhs index 4f37831..5494999 100644 --- a/compiler/types/Generics.lhs +++ b/compiler/types/Generics.lhs @@ -1,3 +1,7 @@ +% +% (c) The University of Glasgow 2006 +% + \begin{code} module Generics ( canDoGenerics, mkTyConGenericBinds, mkGenericRhs, @@ -6,30 +10,24 @@ module Generics ( canDoGenerics, mkTyConGenericBinds, import HsSyn -import Type ( Type, isUnLiftedType, tyVarsOfType, - isTyVarTy, getTyVar_maybe, funTyCon - ) -import TcHsSyn ( mkSimpleHsAlt ) -import TcType ( tcSplitTyConApp_maybe, tcSplitSigmaTy, tcSplitPhiTy, applyTy, - isTauTy, mkTyVarTy ) -import DataCon ( DataCon, dataConOrigArgTys, isVanillaDataCon, - dataConSourceArity ) - -import TyCon ( TyCon, tyConName, tyConDataCons, - isBoxedTupleTyCon - ) -import Name ( nameModule, nameOccName, getSrcLoc ) -import OccName ( mkGenOcc1, mkGenOcc2 ) -import RdrName ( RdrName, getRdrName, mkVarUnqual, mkOrig ) -import BasicTypes ( EP(..), Boxity(..) ) -import Var ( TyVar ) -import VarSet ( varSetElems ) -import Id ( Id, idType ) -import TysWiredIn ( listTyCon ) +import Type +import TcHsSyn +import TcType +import DataCon + +import TyCon +import Name +import OccName +import RdrName +import BasicTypes +import Var +import VarSet +import Id +import TysWiredIn import PrelNames -import SrcLoc ( srcLocSpan, noLoc, Located(..) ) -import Util ( takeList, isSingleton ) +import SrcLoc +import Util import Bag import Outputable import FastString diff --git a/compiler/types/InstEnv.lhs b/compiler/types/InstEnv.lhs index d8f549d..b8e10d5 100644 --- a/compiler/types/InstEnv.lhs +++ b/compiler/types/InstEnv.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[InstEnv]{Utilities for typechecking instance declarations} @@ -20,27 +21,24 @@ module InstEnv ( #include "HsVersions.h" -import Class ( Class ) -import Var ( Id, TyVar, isTcTyVar ) +import Class +import Var import VarSet -import Name ( Name, NamedThing(..), getSrcLoc, nameIsLocalOrFrom, nameModule ) -import OccName ( OccName ) -import NameSet ( unionNameSets, unitNameSet, nameSetToList ) -import Type ( TvSubst ) -import TcType ( Type, PredType, tcEqType, - tcSplitDFunTy, tyVarsOfTypes, isExistentialTyVar, - pprThetaArrow, pprClassPred, - tyClsNamesOfType, tcSplitTyConApp_maybe - ) -import TyCon ( tyConName ) -import TcGadt ( tcUnifyTys, BindFlag(..) ) -import Unify ( tcMatchTys ) +import Name +import OccName +import NameSet +import Type +import TcType +import TyCon +import TcGadt +import Unify import Outputable -import BasicTypes ( OverlapFlag(..) ) -import UniqFM ( UniqFM, lookupUFM, emptyUFM, addToUFM_C, eltsUFM ) -import Id ( idType, idName ) -import SrcLoc ( pprDefnLoc ) -import Maybe ( isJust, isNothing ) +import BasicTypes +import UniqFM +import Id +import SrcLoc + +import Data.Maybe ( isJust, isNothing ) \end{code} diff --git a/compiler/types/TyCon.lhs b/compiler/types/TyCon.lhs index d91effe..fc27995 100644 --- a/compiler/types/TyCon.lhs +++ b/compiler/types/TyCon.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[TyCon]{The @TyCon@ datatype} + +The @TyCon@ datatype \begin{code} module TyCon( @@ -66,13 +68,13 @@ module TyCon( import {-# SOURCE #-} TypeRep ( Kind, Type, PredType ) import {-# SOURCE #-} DataCon ( DataCon, isVanillaDataCon ) -import Var ( TyVar, Id ) -import Class ( Class ) -import BasicTypes ( Arity, RecFlag(..), Boxity(..), isBoxed ) -import Name ( Name, nameUnique, NamedThing(getName) ) -import PrelNames ( Unique, Uniquable(..) ) -import Maybe ( isJust ) -import Maybes ( orElse ) +import Var +import Class +import BasicTypes +import Name +import PrelNames +import Maybe +import Maybes import Outputable import FastString \end{code} diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs index f816493..deaef17 100644 --- a/compiler/types/Type.lhs +++ b/compiler/types/Type.lhs @@ -1,8 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1998 % -\section[Type]{Type - public interface} +Type - public interface \begin{code} module Type ( @@ -105,36 +106,23 @@ module Type ( import TypeRep -- friends: -import Var ( Var, TyVar, tyVarKind, tyVarName, - setTyVarName, setTyVarKind, mkWildCoVar ) +import Var import VarEnv import VarSet -import OccName ( tidyOccName ) -import Name ( NamedThing(..), tidyNameOcc ) -import Class ( Class, classTyCon ) -import PrelNames( openTypeKindTyConKey, unliftedTypeKindTyConKey, - ubxTupleKindTyConKey, argTypeKindTyConKey ) -import TyCon ( TyCon, isPrimTyCon, - isUnboxedTupleTyCon, isUnLiftedTyCon, - isFunTyCon, isNewTyCon, isClosedNewTyCon, - newTyConRep, newTyConRhs, - isAlgTyCon, isSuperKindTyCon, - tcExpandTyCon_maybe, coreExpandTyCon_maybe, - tyConKind, PrimRep(..), tyConPrimRep, tyConUnique - ) +import OccName +import Name +import Class +import PrelNames +import TyCon -- others -import StaticFlags ( opt_DictsStrict ) -import Util ( mapAccumL, seqList, snocView, thenCmp, isEqual, all2 ) +import StaticFlags +import Util import Outputable -import UniqSet ( sizeUniqSet ) -- Should come via VarSet -import Maybe ( isJust ) +import UniqSet -#ifdef DEBUG -import TyCon ( isRecursiveTyCon, tyConArity, isCoercionTyCon ) -import Util ( lengthIs ) -#endif +import Data.Maybe ( isJust ) \end{code} diff --git a/compiler/types/TypeRep.lhs b/compiler/types/TypeRep.lhs index 9110d68..04cc11f 100644 --- a/compiler/types/TypeRep.lhs +++ b/compiler/types/TypeRep.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1998 % \section[TypeRep]{Type - friends' interface} @@ -43,24 +44,18 @@ module TypeRep ( #include "HsVersions.h" import {-# SOURCE #-} DataCon( DataCon, dataConName ) --- friends: -import Var ( Var, Id, TyVar, tyVarKind ) -import VarSet ( TyVarSet ) -import Name ( Name, NamedThing(..), BuiltInSyntax(..), mkWiredInName ) -import OccName ( mkOccNameFS, tcName, parenSymOcc ) -import BasicTypes ( IPName, tupleParens ) -import TyCon ( TyCon, mkFunTyCon, tyConArity, tupleTyConBoxity, isTupleTyCon, - isRecursiveTyCon, isNewTyCon, mkVoidPrimTyCon, - mkSuperKindTyCon ) -import Class ( Class ) +-- friends: +import Var +import VarSet +import Name +import OccName +import BasicTypes +import TyCon +import Class -- others -import PrelNames ( gHC_PRIM, funTyConKey, tySuperKindTyConKey, - coSuperKindTyConKey, liftedTypeKindTyConKey, - openTypeKindTyConKey, unliftedTypeKindTyConKey, - ubxTupleKindTyConKey, argTypeKindTyConKey, listTyConKey, - parrTyConKey, hasKey ) +import PrelNames import Outputable \end{code} diff --git a/compiler/types/Unify.lhs b/compiler/types/Unify.lhs index 0f810da..9d94a63 100644 --- a/compiler/types/Unify.lhs +++ b/compiler/types/Unify.lhs @@ -1,3 +1,7 @@ +% +% (c) The University of Glasgow 2006 +% + \begin{code} module Unify ( -- Matching of types: @@ -8,13 +12,11 @@ module Unify ( #include "HsVersions.h" -import Var ( Var, TyVar, tyVarKind ) +import Var import VarEnv import VarSet -import Type ( typeKind, tyVarsOfType, tyVarsOfTypes, tyVarsOfTheta, - TvSubstEnv, emptyTvSubstEnv, TvSubst(..), tcEqTypeX, - tcView, isSubKind, repSplitAppTy_maybe ) -import TypeRep ( Type(..), PredType(..) ) +import Type +import TypeRep import Outputable import Maybes \end{code}