Commit 49c98d14 authored by Simon Marlow's avatar Simon Marlow

Module header tidyup, phase 1

This patch is a start on removing import lists and generally tidying
up the top of each module.  In addition to removing import lists:

   - Change DATA.IOREF -> Data.IORef etc.
   - Change List -> Data.List etc.
   - Remove $Id$
   - Update copyrights
   - Re-order imports to put non-GHC imports last
   - Remove some unused and duplicate imports
parent b00b5bc0
......@@ -22,42 +22,6 @@ you will screw up the layout where they are used in case expressions!
* settings for the target plat instead). */
#include "../includes/ghcautoconf.h"
#if __GLASGOW_HASKELL__ >= 504
#define CONCURRENT Control.Concurrent
#define EXCEPTION Control.Exception
/* If you want Control.Exception.try, get it as Panic.try, which
deals with the shift from 'tryAllIO' to 'try'. */
#define DYNAMIC Data.Dynamic
#define GLAEXTS GHC.Exts
#define DATA_BITS Data.Bits
#define DATA_INT Data.Int
#define DATA_WORD Data.Word
#define UNSAFE_IO System.IO.Unsafe
#define TRACE Debug.Trace
#define DATA_IOREF Data.IORef
#define FIX_IO System.IO
#define MONAD_ST Control.Monad.ST
#define ST_ARRAY Data.Array.ST
#else
#define CONCURRENT Concurrent
#define EXCEPTION Exception
#define DYNAMIC Dynamic
#define GLAEXTS GlaExts
#define DATA_BITS Bits
#define DATA_INT Int
#define DATA_WORD Word
#define UNSAFE_IO IOExts
#define TRACE IOExts
#define DATA_IOREF IOExts
#define FIX_IO IOExts
#define MONAD_ST ST
#define ST_ARRAY ST
#endif
#ifdef __GLASGOW_HASKELL__
#define GLOBAL_VAR(name,value,ty) \
name = Util.global (value) :: IORef (ty); \
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1997-1998
%
\section[BasicTypes]{Miscellanous types}
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1998
%
\section[DataCon]{@DataCon@: Data Constructors}
......@@ -29,26 +30,18 @@ module DataCon (
#include "HsVersions.h"
import Type ( Type, ThetaType,
substTyWith, substTyVar, mkTopTvSubst,
mkForAllTys, mkFunTys, mkTyConApp, mkTyVarTy, mkTyVarTys,
splitTyConApp_maybe, newTyConInstRhs,
mkPredTys, isStrictPred, pprType
)
import Coercion ( isEqPred, mkEqPred )
import TyCon ( TyCon, FieldLabel, tyConDataCons,
isProductTyCon, isTupleTyCon, isUnboxedTupleTyCon,
isNewTyCon, isClosedNewTyCon, isRecursiveTyCon,
tyConFamInst_maybe )
import Class ( Class, classTyCon )
import Name ( Name, NamedThing(..), nameUnique )
import Var ( TyVar, Id )
import BasicTypes ( Arity, StrictnessMark(..) )
import Type
import Coercion
import TyCon
import Class
import Name
import Var
import BasicTypes
import Outputable
import Unique ( Unique, Uniquable(..) )
import ListSetOps ( assoc, minusList )
import Util ( zipEqual, zipWithEqual )
import Maybes ( expectJust )
import Unique
import ListSetOps
import Util
import Maybes
import FastString
\end{code}
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[Demand]{@Demand@: the amount of demand on a value}
......@@ -27,7 +28,7 @@ module Demand(
#include "HsVersions.h"
import Outputable
import Util ( listLengthCmp )
import Util
\end{code}
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[Id]{@Ids@: Value and constructor identifiers}
......@@ -79,42 +80,29 @@ module Id (
#include "HsVersions.h"
import CoreSyn ( Unfolding, CoreRule )
import BasicTypes ( Arity )
import Var ( Id, DictId,
isId, isExportedId, isLocalId,
idName, idType, idUnique, idInfo, isGlobalId,
setIdName, setIdType, setIdUnique,
setIdExported, setIdNotExported,
setIdInfo, lazySetIdInfo, modifyIdInfo,
maybeModifyIdInfo,
globalIdDetails
)
import qualified Var ( mkLocalId, mkGlobalId, mkExportedLocalId )
import TyCon ( FieldLabel, TyCon )
import Type ( Type, typePrimRep, addFreeTyVars, seqType,
splitTyConApp_maybe, PrimRep )
import TcType ( isDictTy )
import TysPrim ( statePrimTyCon )
import CoreSyn
import BasicTypes
import qualified Var
import Var hiding (mkLocalId, mkGlobalId, mkExportedLocalId)
import TyCon
import Type
import TcType
import TysPrim
import IdInfo
#ifdef OLD_STRICTNESS
import qualified Demand ( Demand )
import qualified Demand
#endif
import DataCon ( DataCon, isUnboxedTupleCon )
import NewDemand ( Demand, StrictSig, topDmd, topSig, isBottomingSig )
import Name ( Name, OccName, nameIsLocalOrFrom,
mkSystemVarName, mkInternalName, getOccName,
getSrcLoc )
import Module ( Module )
import OccName ( mkWorkerOcc )
import Maybes ( orElse )
import SrcLoc ( SrcLoc )
import DataCon
import NewDemand
import Name
import Module
import OccName
import Maybes
import SrcLoc
import Outputable
import Unique ( Unique, mkBuiltinUnique )
import FastString ( FastString )
import StaticFlags ( opt_NoStateHack )
import Unique
import FastString
import StaticFlags
-- infixl so you can say (id `set` a `set` b)
infixl 1 `setIdUnfolding`,
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1993-1998
%
\section[IdInfo]{@IdInfos@: Non-essential information about @Ids@}
......@@ -75,31 +76,26 @@ module IdInfo (
#include "HsVersions.h"
import CoreSyn
import Class ( Class )
import PrimOp ( PrimOp )
import Var ( Id )
import VarSet ( VarSet, emptyVarSet, seqVarSet )
import BasicTypes ( OccInfo(..), isFragileOcc, isDeadOcc, seqOccInfo, isLoopBreaker,
InsideLam, insideLam, notInsideLam,
OneBranch, oneBranch, notOneBranch,
Arity,
Activation(..)
)
import DataCon ( DataCon )
import TyCon ( TyCon, FieldLabel )
import ForeignCall ( ForeignCall )
import Class
import PrimOp
import Var
import VarSet
import BasicTypes
import DataCon
import TyCon
import ForeignCall
import NewDemand
import Outputable
import Maybe ( isJust )
import Data.Maybe
#ifdef OLD_STRICTNESS
import Name ( Name )
import Demand hiding( Demand, seqDemand )
import Name
import Demand
import qualified Demand
import Util ( listLengthCmp )
import List ( replicate )
import Util
import Data.List
#endif
-- infixl so you can say (id `set` a `set` b)
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1998
%
\section[Literal]{@Literal@: Machine literals (unboxed, of course)}
......@@ -26,24 +27,21 @@ module Literal
#include "HsVersions.h"
import TysPrim ( charPrimTy, addrPrimTy, floatPrimTy, doublePrimTy,
intPrimTy, wordPrimTy, int64PrimTy, word64PrimTy
)
import Type ( Type )
import TysPrim
import Type
import Outputable
import FastTypes
import FastString
import Binary
import Ratio
import FastString
import Ratio ( numerator )
import FastString ( uniqueOfFS, lengthFS )
import DATA_INT ( Int8, Int16, Int32 )
import DATA_WORD ( Word8, Word16, Word32 )
import Char ( ord, chr )
import Data.Int
import Data.Word
import Data.Char
\end{code}
%************************************************************************
%* *
\subsection{Sizes}
......
%
% (c) The University of Glasgow 2006
% (c) The AQUA Project, Glasgow University, 1998
%
\section[StdIdInfo]{Standard unfoldings}
This module contains definitions for the IdInfo for things that
have a standard form, namely:
......@@ -38,71 +38,40 @@ module MkId (
#include "HsVersions.h"
import BasicTypes ( Arity, StrictnessMark(..), isMarkedUnboxed, isMarkedStrict )
import Rules ( mkSpecInfo )
import TysPrim ( openAlphaTyVars, alphaTyVar, alphaTy,
realWorldStatePrimTy, addrPrimTy
)
import TysWiredIn ( charTy, mkListTy )
import PrelRules ( primOpRules )
import Type ( TyThing(..), mkForAllTy, tyVarsOfTypes,
newTyConInstRhs, mkTopTvSubst, substTyVar,
substTys, zipTopTvSubst )
import TcGadt ( gadtRefine, refineType, emptyRefinement )
import HsBinds ( HsWrapper(..), isIdHsWrapper )
import Coercion ( mkSymCoercion, mkUnsafeCoercion, isEqPred )
import TcType ( Type, ThetaType, mkDictTy, mkPredTys, mkPredTy,
mkTyConApp, mkTyVarTys, mkClassPred, isPredTy,
mkFunTys, mkFunTy, mkSigmaTy, tcSplitSigmaTy, tcEqType,
isUnLiftedType, mkForAllTys, mkTyVarTy, tyVarsOfType,
tcSplitFunTys, tcSplitForAllTys, dataConsStupidTheta
)
import CoreUtils ( exprType, dataConOrigInstPat, mkCoerce )
import CoreUnfold ( mkTopUnfolding, mkCompulsoryUnfolding )
import Literal ( nullAddrLit, mkStringLit )
import TyCon ( TyCon, isNewTyCon, tyConTyVars, tyConDataCons,
FieldLabel,
tyConStupidTheta, isProductTyCon, isDataTyCon,
isRecursiveTyCon, isFamInstTyCon,
tyConFamInst_maybe, tyConFamilyCoercion_maybe,
newTyConCo_maybe )
import Class ( Class, classTyCon, classSelIds )
import Var ( Id, TyVar, Var, setIdType )
import VarSet ( isEmptyVarSet, subVarSet, varSetElems )
import Name ( mkFCallName, mkWiredInName, Name, BuiltInSyntax(..))
import OccName ( mkOccNameFS, varName )
import PrimOp ( PrimOp, primOpSig, primOpOcc, primOpTag )
import ForeignCall ( ForeignCall )
import DataCon ( DataCon, DataConIds(..), dataConTyCon,
dataConUnivTyVars,
dataConFieldLabels, dataConRepArity, dataConResTys,
dataConRepArgTys, dataConRepType, dataConFullSig,
dataConStrictMarks, dataConExStricts,
splitProductType, isVanillaDataCon, dataConFieldType,
deepSplitProductType,
)
import Id ( idType, mkGlobalId, mkVanillaGlobal, mkSysLocal,
mkTemplateLocals, mkTemplateLocalsNum, mkExportedLocalId,
mkTemplateLocal, idName
)
import IdInfo ( IdInfo, noCafIdInfo, setUnfoldingInfo,
setArityInfo, setSpecInfo, setCafInfo,
setAllStrictnessInfo, vanillaIdInfo,
GlobalIdDetails(..), CafInfo(..)
)
import NewDemand ( mkStrictSig, DmdResult(..),
mkTopDmdType, topDmd, evalDmd, lazyDmd, retCPR,
Demand(..), Demands(..) )
import DmdAnal ( dmdAnalTopRhs )
import Rules
import TysPrim
import TysWiredIn
import PrelRules
import Type
import TcGadt
import HsBinds
import Coercion
import TcType
import CoreUtils
import CoreUnfold
import Literal
import TyCon
import Class
import VarSet
import Name
import OccName
import PrimOp
import ForeignCall
import DataCon
import Id
import Var ( Var, TyVar)
import IdInfo
import NewDemand
import DmdAnal
import CoreSyn
import Unique ( mkBuiltinUnique, mkPrimOpIdUnique )
import Unique
import Maybes
import PrelNames
import Util ( dropList, isSingleton )
import BasicTypes hiding ( SuccessFlag(..) )
import Util
import Outputable
import FastString
import ListSetOps ( assoc, minusList )
import ListSetOps
\end{code}
%************************************************************************
......@@ -1226,9 +1195,5 @@ pc_bottoming_Id name ty
strict_sig = mkStrictSig (mkTopDmdType [evalDmd] BotRes)
-- These "bottom" out, no matter what their arguments
(openAlphaTyVar:openBetaTyVar:_) = openAlphaTyVars
openAlphaTy = mkTyVarTy openAlphaTyVar
openBetaTy = mkTyVarTy openBetaTyVar
\end{code}
%
% (c) The University of Glasgow, 2004
% (c) The University of Glasgow, 2004-2006
%
Module
......@@ -48,10 +48,10 @@ module Module
#include "HsVersions.h"
import Outputable
import Unique ( Uniquable(..) )
import Unique
import FiniteMap
import UniqFM
import PackageConfig ( PackageId, packageIdFS, mainPackageId )
import PackageConfig
import FastString
import Binary
\end{code}
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[Name]{@Name@: to transmit name info from renamer to typechecker}
......@@ -37,21 +38,20 @@ module Name (
import {-# SOURCE #-} TypeRep( TyThing )
import OccName -- All of it
import Module ( Module )
import SrcLoc ( noSrcLoc, wiredInSrcLoc, SrcLoc )
import UniqFM ( lookupUFM, addToUFM )
import Unique ( Unique, Uniquable(..), getKey, pprUnique,
mkUniqueGrimily, getKey# )
import Maybes ( orElse, isJust )
import OccName
import Module
import SrcLoc
import UniqFM
import Unique
import Maybes
import Binary
import FastMutInt
import FastString ( FastString, zEncodeFS )
import FastString
import Outputable
import DATA_IOREF
import GLAEXTS ( Int#, Int(..) )
import Data.Array ( (!) )
import Data.IORef
import GHC.Exts
import Data.Array
\end{code}
%************************************************************************
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[NameEnv]{@NameEnv@: name environments}
......@@ -17,9 +18,9 @@ module NameEnv (
#include "HsVersions.h"
import Name ( Name )
import Name
import UniqFM
import Maybes ( expectJust )
import Maybes
\end{code}
%************************************************************************
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1998
%
\section[NameSet]{@NameSets@}
\begin{code}
module NameSet (
......@@ -28,7 +28,6 @@ import Name
import UniqSet
\end{code}
%************************************************************************
%* *
\subsection[Sets of names}
......@@ -187,4 +186,4 @@ findUses dus uses
= rhs_uses `unionNameSets` uses
| otherwise -- No def is used
= uses
\end{code}
\ No newline at end of file
\end{code}
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[Demand]{@Demand@: the amount of demand on a value}
......@@ -24,11 +25,11 @@ module NewDemand(
#include "HsVersions.h"
import StaticFlags ( opt_CprOff )
import BasicTypes ( Arity )
import VarEnv ( VarEnv, emptyVarEnv, isEmptyVarEnv )
import UniqFM ( ufmToList )
import Util ( listLengthCmp, zipWithEqual )
import StaticFlags
import BasicTypes
import VarEnv
import UniqFM
import Util
import Outputable
\end{code}
......
{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-}
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[OccName]{@OccName@}
\begin{code}
module OccName (
-- * The NameSpace type; abstact
......@@ -65,19 +63,18 @@ module OccName (
#include "HsVersions.h"
import Util ( thenCmp )
import Unique ( Unique, mkUnique, Uniquable(..) )
import BasicTypes ( Boxity(..), Arity )
import StaticFlags ( opt_PprStyle_Debug )
import Util
import Unique
import BasicTypes
import StaticFlags
import UniqFM
import UniqSet
import FastString
import Outputable
import Binary
import GLAEXTS
import Data.Char ( isUpper, isLower, ord )
import GHC.Exts
import Data.Char
-- Unicode TODO: put isSymbol in libcompat
#if __GLASGOW_HASKELL__ > 604
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[RdrName]{@RdrName@}
\begin{code}
module RdrName (
RdrName(..), -- Constructors exported only to BinIface
......@@ -41,14 +40,13 @@ module RdrName (
#include "HsVersions.h"
import OccName
import Module ( ModuleName, mkModuleNameFS, Module, moduleName )
import Name ( Name, NamedThing(getName), nameModule,
nameOccName, isExternalName, nameSrcLoc )
import Maybes ( mapCatMaybes )
import SrcLoc ( isGoodSrcLoc, isGoodSrcSpan, srcLocSpan, SrcSpan )
import FastString ( FastString )
import Module
import Name
import Maybes
import SrcLoc
import FastString
import Outputable
import Util ( thenCmp )
import Util
\end{code}
%************************************************************************
......
%
% (c) The University of Glasgow, 1992-2003
% (c) The University of Glasgow, 1992-2006
%
%************************************************************************
%* *
\section[SrcLoc]{The @SrcLoc@ type}
%* *
%************************************************************************
\begin{code}
module SrcLoc (
......@@ -42,7 +37,7 @@ module SrcLoc (
#include "HsVersions.h"
import Util ( thenCmp )
import Util
import Outputable
import FastString
\end{code}
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section[UniqSupply]{The @UniqueSupply@ data type and a (monadic) supply thereof}
\begin{code}
module UniqSupply (
......@@ -25,8 +25,8 @@ module UniqSupply (
import Unique
import GLAEXTS
import UNSAFE_IO ( unsafeInterleaveIO )
import GHC.Exts
import System.IO.Unsafe ( unsafeInterleaveIO )
w2i x = word2Int# x
i2w x = int2Word# x
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
......@@ -49,15 +50,14 @@ module Unique (
#include "HsVersions.h"
import BasicTypes ( Boxity(..) )
import PackageConfig ( PackageId, packageIdFS )
import FastString ( FastString, uniqueOfFS )
import BasicTypes
import PackageConfig
import FastString
import Outputable
import FastTypes
import GLAEXTS
import Char ( chr, ord )
import GHC.Exts
import Data.Char ( chr, ord )
\end{code}
%************************************************************************
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section{@Vars@: Variables}
......@@ -37,11 +38,10 @@ module Var (
import {-# SOURCE #-} TypeRep( Type, Kind )
import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails )
import {-# SOURCE #-} IdInfo( GlobalIdDetails, notGlobalId, IdInfo, seqIdInfo )
import Name ( Name, NamedThing(..), setNameUnique, nameUnique, mkSysTvName )
import Unique ( Unique, Uniquable(..), mkUniqueGrimily, getKey#,
mkBuiltinUnique )
import {-# SOURCE #-} IdInfo( GlobalIdDetails, notGlobalId,
IdInfo, seqIdInfo )
import Name hiding (varName)
import Unique
import FastTypes
import FastString
import Outputable
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section{@VarEnvs@: Variable environments}
\begin{code}
module VarEnv (
......@@ -36,14 +36,14 @@ module VarEnv (
#include "HsVersions.h"
import OccName ( TidyOccEnv, emptyTidyOccEnv )
import Var ( Var, setVarUnique )
import OccName
import Var
import VarSet
import UniqFM
import Unique ( Unique, deriveUnique, getUnique )
import Util ( zipEqual, foldl2 )
import Maybes ( orElse )
import StaticFlags( opt_PprStyle_Debug )
import Unique
import Util
import Maybes
import StaticFlags
import Outputable
import FastTypes
\end{code}
......
%
% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
\section{@VarSet@: Variable sets}
\begin{code}
module VarSet (
......@@ -19,10 +19,10 @@ module VarSet (
#include "HsVersions.h"
import Var ( Var, Id, TyVar )
import Unique ( Unique )
import Var
import Unique
import UniqSet
import UniqFM ( delFromUFM_Directly, addToUFM_C )
import UniqFM
\end{code}
%************************************************************************
......