From 046ee54f048ddd721dcee41916d6a6f68db3b15b Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 11 Oct 2006 14:35:23 +0000 Subject: [PATCH] Module header tidyup #2 Push this further along, and fix build problems in the first patch. --- compiler/HsVersions.h | 6 +++++ compiler/main/DriverMkDepend.hs | 16 ++++++------- compiler/main/DriverPipeline.hs | 23 +++++++++--------- compiler/main/DynFlags.hs | 12 +++++----- compiler/main/ErrUtils.lhs | 7 +++--- compiler/main/Finder.lhs | 5 ++-- compiler/main/HeaderInfo.hs | 6 ++--- compiler/main/Main.hs | 15 ++++++------ compiler/main/Packages.lhs | 17 ++++++-------- compiler/main/ParsePkgConf.y | 2 +- compiler/main/StaticFlags.hs | 10 ++++---- compiler/main/SysTools.lhs | 44 +++++++++++++++-------------------- compiler/nativeGen/AsmCodeGen.lhs | 8 +++---- compiler/nativeGen/MachCodeGen.hs | 8 +++---- compiler/nativeGen/MachInstrs.hs | 2 +- compiler/nativeGen/PprMach.hs | 15 ++++-------- compiler/nativeGen/RegisterAlloc.hs | 12 +++++----- compiler/parser/Ctype.lhs | 6 ++--- compiler/parser/Lexer.x | 6 ++--- compiler/parser/Parser.y.pp | 4 ++-- compiler/utils/Bag.lhs | 7 ++++-- compiler/utils/Binary.hs | 4 ++-- compiler/utils/BufWrite.hs | 10 ++++---- compiler/utils/Digraph.lhs | 18 +++++++------- compiler/utils/FastMutInt.lhs | 7 +----- compiler/utils/FastTypes.lhs | 4 ++-- compiler/utils/FiniteMap.lhs | 6 ++--- compiler/utils/IOEnv.hs | 10 ++++---- compiler/utils/ListSetOps.lhs | 4 +++- compiler/utils/Maybes.lhs | 7 +++--- compiler/utils/OrdList.lhs | 1 + compiler/utils/Outputable.lhs | 13 +++++------ compiler/utils/Panic.lhs | 29 ++++++++--------------- compiler/utils/Pretty.lhs | 6 ++--- compiler/utils/StringBuffer.lhs | 2 +- compiler/utils/UniqFM.lhs | 8 ++++--- compiler/utils/UniqSet.lhs | 1 + compiler/utils/Util.lhs | 31 ++++++++++++------------ 38 files changed, 191 insertions(+), 201 deletions(-) diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h index 68884c0..f11aa21 100644 --- a/compiler/HsVersions.h +++ b/compiler/HsVersions.h @@ -22,6 +22,12 @@ 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__ >= 602 +#define SYSTEM_IO_ERROR System.IO.Error +#else +#define SYSTEM_IO_ERROR System.IO +#endif + #ifdef __GLASGOW_HASKELL__ #define GLOBAL_VAR(name,value,ty) \ name = Util.global (value) :: IORef (ty); \ diff --git a/compiler/main/DriverMkDepend.hs b/compiler/main/DriverMkDepend.hs index 56f57f0..74c8037 100644 --- a/compiler/main/DriverMkDepend.hs +++ b/compiler/main/DriverMkDepend.hs @@ -34,14 +34,14 @@ import Panic ( catchJust, ioErrors ) #endif import ErrUtils ( debugTraceMsg, printErrorsAndWarnings ) -import DATA_IOREF ( IORef, readIORef, writeIORef ) -import EXCEPTION - -import System ( ExitCode(..), exitWith ) -import Directory -import IO -import Monad ( when ) -import Maybe ( isJust ) +import Data.IORef ( IORef, readIORef, writeIORef ) +import Control.Exception +import System.Exit ( ExitCode(..), exitWith ) +import System.Directory +import System.IO +import SYSTEM_IO_ERROR ( isEOFError ) +import Control.Monad ( when ) +import Data.Maybe ( isJust ) ----------------------------------------------------------------- -- diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 690328d..9e33f51 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -50,17 +50,18 @@ import ParserCoreUtils ( getCoreModuleName ) import SrcLoc ( unLoc ) import SrcLoc ( Located(..) ) -import EXCEPTION -import DATA_IOREF ( readIORef, writeIORef, IORef ) -import GLAEXTS ( Int(..) ) - -import Directory -import System -import IO -import Monad +import Control.Exception as Exception +import Data.IORef ( readIORef, writeIORef, IORef ) +import GHC.Exts ( Int(..) ) +import System.Directory +import System.IO +import SYSTEM_IO_ERROR as IO +import Control.Monad import Data.List ( isSuffixOf ) -import Maybe - +import Data.Maybe +import System.Exit +import System.Cmd +import System.Environment -- --------------------------------------------------------------------------- -- Pre-process @@ -1133,7 +1134,7 @@ checkProcessArgsResult flags filename getHCFilePackages :: FilePath -> IO [PackageId] getHCFilePackages filename = - EXCEPTION.bracket (openFile filename ReadMode) hClose $ \h -> do + Exception.bracket (openFile filename ReadMode) hClose $ \h -> do l <- hGetLine h case l of '/':'*':' ':'G':'H':'C':'_':'P':'A':'C':'K':'A':'G':'E':'S':rest -> diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 9a8804a..20376f0 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -69,20 +69,20 @@ import UniqFM ( UniqFM ) import Util ( notNull, splitLongestPrefix, normalisePath ) import Maybes ( fromJust, orElse ) import SrcLoc ( SrcSpan ) +import Outputable +import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage ) -import DATA_IOREF ( readIORef ) -import EXCEPTION ( throwDyn ) -import Monad ( when ) +import Data.IORef ( readIORef ) +import Control.Exception ( throwDyn ) +import Control.Monad ( when ) #ifdef mingw32_TARGET_OS import Data.List ( isPrefixOf ) #else import Util ( split ) #endif -import Char ( isDigit, isUpper ) -import Outputable +import Data.Char ( isDigit, isUpper ) import System.IO ( hPutStrLn, stderr ) -import {-# SOURCE #-} ErrUtils ( Severity(..), Message, mkLocMessage ) -- ----------------------------------------------------------------------------- -- DynFlags diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index 7bdb019..4f8fa14 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -37,9 +37,10 @@ import qualified Pretty import SrcLoc ( srcSpanStart, noSrcSpan ) import DynFlags ( DynFlags(..), DynFlag(..), dopt ) import StaticFlags ( opt_ErrorSpans ) -import System ( ExitCode(..), exitWith ) -import IO ( hPutStrLn, stderr ) -import DYNAMIC + +import System.Exit ( ExitCode(..), exitWith ) +import System.IO ( hPutStrLn, stderr ) +import Data.Dynamic -- ----------------------------------------------------------------------------- diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs index 1f047fa..df1fa3e 100644 --- a/compiler/main/Finder.lhs +++ b/compiler/main/Finder.lhs @@ -37,13 +37,12 @@ import FiniteMap import UniqFM import Maybes ( expectJust ) -import DATA_IOREF ( IORef, writeIORef, readIORef, modifyIORef ) - +import Data.IORef ( IORef, writeIORef, readIORef, modifyIORef ) import Data.List import System.Directory import System.IO import Control.Monad -import Time ( ClockTime ) +import System.Time ( ClockTime ) type FileExt = String -- Filename extension diff --git a/compiler/main/HeaderInfo.hs b/compiler/main/HeaderInfo.hs index 48eda22..1566137 100644 --- a/compiler/main/HeaderInfo.hs +++ b/compiler/main/HeaderInfo.hs @@ -35,9 +35,9 @@ import Bag ( emptyBag, listToBag ) import Distribution.Compiler -import EXCEPTION ( throwDyn ) -import IO -import List +import Control.Exception +import System.IO +import Data.List #if __GLASGOW_HASKELL__ >= 601 import System.IO ( openBinaryFile ) diff --git a/compiler/main/Main.hs b/compiler/main/Main.hs index 55234e7..f7c5be7 100644 --- a/compiler/main/Main.hs +++ b/compiler/main/Main.hs @@ -41,13 +41,14 @@ import Util import Panic -- Standard Haskell libraries -import EXCEPTION ( throwDyn ) -import IO -import Directory ( doesDirectoryExist ) -import System ( getArgs, exitWith, ExitCode(..) ) -import Monad -import List -import Maybe +import Control.Exception ( throwDyn ) +import System.IO +import System.Directory ( doesDirectoryExist ) +import System.Environment +import System.Exit +import Control.Monad +import Data.List +import Data.Maybe ----------------------------------------------------------------------------- -- ToDo: diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs index bbaf846..fb54a12 100644 --- a/compiler/main/Packages.lhs +++ b/compiler/main/Packages.lhs @@ -42,15 +42,12 @@ import Config ( cProjectVersion ) import Name ( Name, nameModule_maybe ) import UniqFM import Module -import UniqSet import Util import Maybes ( expectJust, MaybeErr(..) ) import Panic import Outputable -#if __GLASGOW_HASKELL__ >= 603 -import System.Directory ( getAppUserDataDirectory ) -#else +#if __GLASGOW_HASKELL__ < 603 import Compat.Directory ( getAppUserDataDirectory ) #endif @@ -58,15 +55,15 @@ import System.Environment ( getEnv ) import Distribution.InstalledPackageInfo import Distribution.Package import Distribution.Version -import System.Directory ( doesFileExist, doesDirectoryExist, - getDirectoryContents ) -import Data.Maybe ( catMaybes ) -import Control.Monad ( foldM ) -import Data.List ( nub, partition, sortBy, isSuffixOf ) import FastString -import EXCEPTION ( throwDyn ) import ErrUtils ( debugTraceMsg, putMsg, Message ) +import System.Directory +import Data.Maybe +import Control.Monad +import Data.List +import Control.Exception ( throwDyn ) + -- --------------------------------------------------------------------------- -- The Package state diff --git a/compiler/main/ParsePkgConf.y b/compiler/main/ParsePkgConf.y index 901a5bc..e29eb94 100644 --- a/compiler/main/ParsePkgConf.y +++ b/compiler/main/ParsePkgConf.y @@ -12,7 +12,7 @@ import ErrUtils ( mkLocMessage ) import SrcLoc import Outputable import Panic ( GhcException(..) ) -import EXCEPTION ( throwDyn ) +import Control.Exception ( throwDyn ) } diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 9e1d8ad..4f4fe66 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -76,11 +76,11 @@ import Util import Maybes ( firstJust ) import Panic ( GhcException(..), ghcError ) -import EXCEPTION ( throwDyn ) -import DATA_IOREF -import UNSAFE_IO ( unsafePerformIO ) -import Monad ( when ) -import Char ( isDigit ) +import Control.Exception ( throwDyn ) +import Data.IORef +import System.IO.Unsafe ( unsafePerformIO ) +import Control.Monad ( when ) +import Data.Char ( isDigit ) import Data.List ( sort, intersperse, nub ) ----------------------------------------------------------------------------- diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index 594407e..874387f 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -37,31 +37,27 @@ module SysTools ( #include "HsVersions.h" -import DriverPhases ( isHaskellUserSrcFilename ) +import DriverPhases import Config import Outputable -import ErrUtils ( putMsg, debugTraceMsg, showPass, Severity(..), Messages ) -import Panic ( GhcException(..) ) -import Util ( Suffix, global, notNull, consIORef, joinFileName, - normalisePath, pgmPath, platformPath, joinFileExt ) -import DynFlags ( DynFlags(..), DynFlag(..), dopt, Option(..), - setTmpDir, defaultDynFlags ) - -import EXCEPTION ( throwDyn, finally ) -import DATA_IOREF ( IORef, readIORef, writeIORef ) -import DATA_INT - -import Monad ( when, unless ) -import System ( ExitCode(..), getEnv, system ) -import IO ( try, catch, hGetContents, - openFile, hPutStr, hClose, hFlush, IOMode(..), - stderr, ioError, isDoesNotExistError, - isAlreadyExistsError ) -import Directory ( doesFileExist, removeFile, - createDirectory, removeDirectory ) -import Maybe ( isJust ) -import List ( partition ) -import FiniteMap ( FiniteMap, emptyFM, lookupFM, addToFM, eltsFM ) +import ErrUtils +import Panic +import Util +import DynFlags +import FiniteMap + +import Control.Exception +import Data.IORef +import Data.Int +import Control.Monad +import System.Exit +import System.Cmd +import System.Environment +import System.IO +import SYSTEM_IO_ERROR as IO +import System.Directory +import Data.Maybe +import Data.List -- GHC <= 4.08 didn't have rawSystem, and runs into problems with long command -- lines on mingw32, so we disallow it now. @@ -88,10 +84,8 @@ import Text.Regex -- rawSystem comes from libghccompat.a in stage1 import Compat.RawSystem ( rawSystem ) import GHC.IOBase ( IOErrorType(..) ) -import System.IO.Error ( ioeGetErrorType ) #else import System.Process ( runInteractiveProcess, getProcessExitCode ) -import System.IO ( hSetBuffering, hGetLine, BufferMode(..) ) import Control.Concurrent( forkIO, newChan, readChan, writeChan ) import Data.Char ( isSpace ) import FastString ( mkFastString ) diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs index 0e05fb8..875f790 100644 --- a/compiler/nativeGen/AsmCodeGen.lhs +++ b/compiler/nativeGen/AsmCodeGen.lhs @@ -53,10 +53,10 @@ import FastString import List ( intersperse ) #endif -import DATA_INT -import DATA_WORD -import DATA_BITS -import GLAEXTS +import Data.Int +import Data.Word +import Data.Bits +import GHC.Exts {- The native-code generator has machine-independent and diff --git a/compiler/nativeGen/MachCodeGen.hs b/compiler/nativeGen/MachCodeGen.hs index 1e88867..aaf7cec 100644 --- a/compiler/nativeGen/MachCodeGen.hs +++ b/compiler/nativeGen/MachCodeGen.hs @@ -42,13 +42,13 @@ import Constants ( wORD_SIZE ) #ifdef DEBUG import Outputable ( assertPanic ) -import TRACE ( trace ) +import Debug.Trace ( trace ) #endif import Control.Monad ( mapAndUnzipM ) -import Maybe ( fromJust ) -import DATA_BITS -import DATA_WORD +import Data.Maybe ( fromJust ) +import Data.Bits +import Data.Word -- ----------------------------------------------------------------------------- -- Top-level of the instruction selector diff --git a/compiler/nativeGen/MachInstrs.hs b/compiler/nativeGen/MachInstrs.hs index 0f718d3..baac1cd 100644 --- a/compiler/nativeGen/MachInstrs.hs +++ b/compiler/nativeGen/MachInstrs.hs @@ -43,7 +43,7 @@ import Outputable import FastString import Constants ( wORD_SIZE ) -import GLAEXTS +import GHC.Exts -- ----------------------------------------------------------------------------- diff --git a/compiler/nativeGen/PprMach.hs b/compiler/nativeGen/PprMach.hs index afa5bcd..274ea1f 100644 --- a/compiler/nativeGen/PprMach.hs +++ b/compiler/nativeGen/PprMach.hs @@ -39,20 +39,15 @@ import qualified Outputable import StaticFlags ( opt_PIC, opt_Static ) -#if __GLASGOW_HASKELL__ >= 504 import Data.Array.ST import Data.Word ( Word8 ) -#else -import MutableArray -#endif - -import MONAD_ST -import Char ( chr, ord ) -import Maybe ( isJust ) +import Control.Monad.ST +import Data.Char ( chr, ord ) +import Data.Maybe ( isJust ) #if powerpc_TARGET_ARCH || darwin_TARGET_OS -import DATA_WORD(Word32) -import DATA_BITS +import Data.Word(Word32) +import Data.Bits #endif -- ----------------------------------------------------------------------------- diff --git a/compiler/nativeGen/RegisterAlloc.hs b/compiler/nativeGen/RegisterAlloc.hs index bbab518..36a098e 100644 --- a/compiler/nativeGen/RegisterAlloc.hs +++ b/compiler/nativeGen/RegisterAlloc.hs @@ -100,13 +100,13 @@ import UniqSupply import Outputable #ifndef DEBUG -import Maybe ( fromJust ) +import Data.Maybe ( fromJust ) #endif -import Maybe ( fromMaybe ) -import List ( nub, partition, mapAccumL, groupBy ) -import Monad ( when ) -import DATA_WORD -import DATA_BITS +import Data.Maybe ( fromMaybe ) +import Data.List ( nub, partition, mapAccumL, groupBy ) +import Control.Monad ( when ) +import Data.Word +import Data.Bits -- ----------------------------------------------------------------------------- -- Some useful types diff --git a/compiler/parser/Ctype.lhs b/compiler/parser/Ctype.lhs index dbe4e9f..8d0b91b 100644 --- a/compiler/parser/Ctype.lhs +++ b/compiler/parser/Ctype.lhs @@ -17,9 +17,9 @@ module Ctype #include "HsVersions.h" -import DATA_INT ( Int32 ) -import DATA_BITS ( Bits((.&.)) ) -import Char ( ord, chr ) +import Data.Int ( Int32 ) +import Data.Bits ( Bits((.&.)) ) +import Data.Char ( ord, chr ) \end{code} Bit masks diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 4806a8a..6a25ae5 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -43,10 +43,10 @@ import DynFlags import Ctype import Util ( maybePrefixMatch, readRational ) -import DATA_BITS +import Data.Bits import Data.Char ( chr, isSpace ) -import Ratio -import TRACE +import Data.Ratio +import Debug.Trace #if __GLASGOW_HASKELL__ >= 605 import Data.Char ( GeneralCategory(..), generalCategory, isPrint, isUpper ) diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index 7166e1e..0209ec8 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -42,10 +42,10 @@ import HaddockUtils import FastString import Maybes ( orElse ) -import Monad ( when ) import Outputable -import GLAEXTS +import Control.Monad ( when ) +import GHC.Exts import Data.Char import Control.Monad ( mplus ) } diff --git a/compiler/utils/Bag.lhs b/compiler/utils/Bag.lhs index ea85a8c..d315c42 100644 --- a/compiler/utils/Bag.lhs +++ b/compiler/utils/Bag.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[Bags]{@Bag@: an unordered collection with duplicates} + +Bag: an unordered collection with duplicates \begin{code} module Bag ( @@ -20,7 +22,8 @@ module Bag ( import Outputable import Util ( isSingleton ) -import List ( partition ) + +import Data.List ( partition ) \end{code} diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 1d5ab0e..e479b79 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -1,6 +1,6 @@ {-# OPTIONS -cpp #-} -- --- (c) The University of Glasgow 2002 +-- (c) The University of Glasgow 2002-2006 -- -- Binary I/O library, with special tweaks for GHC -- @@ -59,7 +59,7 @@ import Unique import Panic import UniqFM import FastMutInt -import PackageConfig ( PackageId, packageIdFS, fsToPackageId ) +import PackageConfig import Foreign import Data.Array.IO diff --git a/compiler/utils/BufWrite.hs b/compiler/utils/BufWrite.hs index a03db3d..049a698 100644 --- a/compiler/utils/BufWrite.hs +++ b/compiler/utils/BufWrite.hs @@ -2,7 +2,7 @@ -- -- Fast write-buffered Handles -- --- (c) The University of Glasgow 2005 +-- (c) The University of Glasgow 2005-2006 -- -- This is a simple abstraction over Handles that offers very fast write -- buffering, but without the thread safety that Handles provide. It's used @@ -26,16 +26,16 @@ import FastString import FastMutInt import Panic ( panic ) -import Monad ( when ) -import Char ( ord ) +import Control.Monad ( when ) +import Data.Char ( ord ) import Foreign -import IO +import System.IO import GHC.IOBase ( IO(..) ) import System.IO ( hPutBuf ) import GHC.Ptr ( Ptr(..) ) -import GLAEXTS ( Int(..), Int#, Addr# ) +import GHC.Exts ( Int(..), Int#, Addr# ) -- ----------------------------------------------------------------------------- diff --git a/compiler/utils/Digraph.lhs b/compiler/utils/Digraph.lhs index 8fda332..669f718 100644 --- a/compiler/utils/Digraph.lhs +++ b/compiler/utils/Digraph.lhs @@ -1,3 +1,7 @@ +% +% (c) The University of Glasgow 2006 +% + \begin{code} module Digraph( @@ -34,22 +38,20 @@ module Digraph( import Util ( sortLe ) +import Outputable -- Extensions -import MONAD_ST +import Control.Monad.ST -- std interfaces -import Maybe -import Array -import List -import Outputable +import Data.Maybe +import Data.Array +import Data.List #if __GLASGOW_HASKELL__ > 604 import Data.Array.ST -#elif __GLASGOW_HASKELL__ >= 504 -import Data.Array.ST hiding ( indices, bounds ) #else -import ST +import Data.Array.ST hiding ( indices, bounds ) #endif \end{code} diff --git a/compiler/utils/FastMutInt.lhs b/compiler/utils/FastMutInt.lhs index b483a14..86ca0bd 100644 --- a/compiler/utils/FastMutInt.lhs +++ b/compiler/utils/FastMutInt.lhs @@ -1,6 +1,6 @@ {-# OPTIONS -cpp #-} -- --- (c) The University of Glasgow 2002 +-- (c) The University of Glasgow 2002-2006 -- -- Unboxed mutable Ints @@ -17,13 +17,8 @@ module FastMutInt( #endif -#if __GLASGOW_HASKELL__ < 503 -import GlaExts -import PrelIOBase -#else import GHC.Base import GHC.IOBase -#endif #if __GLASGOW_HASKELL__ < 411 newByteArray# = newCharArray# diff --git a/compiler/utils/FastTypes.lhs b/compiler/utils/FastTypes.lhs index bb92c8c..c58346d 100644 --- a/compiler/utils/FastTypes.lhs +++ b/compiler/utils/FastTypes.lhs @@ -1,5 +1,5 @@ % -% (c) The University of Glasgow, 2000 +% (c) The University of Glasgow, 2000-2006 % \section{Fast integers and booleans} @@ -17,7 +17,7 @@ module FastTypes ( #if defined(__GLASGOW_HASKELL__) -- Import the beggars -import GLAEXTS +import GHC.Exts ( Int(..), Int#, (+#), (-#), (*#), quotInt#, negateInt#, (==#), (<#), (<=#), (>=#), (>#) ) diff --git a/compiler/utils/FiniteMap.lhs b/compiler/utils/FiniteMap.lhs index 9168d36..6ac6b09 100644 --- a/compiler/utils/FiniteMap.lhs +++ b/compiler/utils/FiniteMap.lhs @@ -1,7 +1,7 @@ - +% +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1994-1998 % -\section[FiniteMap]{An implementation of finite maps} ``Finite maps'' are the heart of the compiler's lookup-tables/environments and its implementation of sets. Important @@ -62,7 +62,7 @@ import Bag ( Bag, foldrBag ) import Util import Outputable -import GLAEXTS +import GHC.Exts #if ! OMIT_NATIVE_CODEGEN # define IF_NCG(a) a diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs index 8116eff..c0277ae 100644 --- a/compiler/utils/IOEnv.hs +++ b/compiler/utils/IOEnv.hs @@ -1,4 +1,5 @@ --- (c) The University of Glasgow 2002 +-- +-- (c) The University of Glasgow 2002-2006 -- -- The IO Monad with an environment -- @@ -26,9 +27,10 @@ module IOEnv ( #include "HsVersions.h" import Panic ( try, tryUser, tryMost, Exception(..) ) -import DATA_IOREF ( IORef, newIORef, readIORef, writeIORef ) -import UNSAFE_IO ( unsafeInterleaveIO ) -import FIX_IO ( fixIO ) + +import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) +import System.IO.Unsafe ( unsafeInterleaveIO ) +import System.IO ( fixIO ) ---------------------------------------------------------------------- diff --git a/compiler/utils/ListSetOps.lhs b/compiler/utils/ListSetOps.lhs index 0295072..becf9e6 100644 --- a/compiler/utils/ListSetOps.lhs +++ b/compiler/utils/ListSetOps.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[ListSetOps]{Set-like operations on lists} @@ -24,7 +25,8 @@ import Outputable import Unique ( Unique ) import UniqFM ( eltsUFM, emptyUFM, addToUFM_C ) import Util ( isn'tIn, isIn, mapAccumR, sortLe ) -import List ( partition ) + +import Data.List ( partition ) \end{code} diff --git a/compiler/utils/Maybes.lhs b/compiler/utils/Maybes.lhs index f1f859a..7d1fa4e 100644 --- a/compiler/utils/Maybes.lhs +++ b/compiler/utils/Maybes.lhs @@ -1,11 +1,11 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[Maybes]{The `Maybe' types and associated utility functions} \begin{code} module Maybes ( - module Maybe, -- Re-export all of Maybe + module Data.Maybe, -- Re-export all of Maybe MaybeErr(..), -- Instance of Monad failME, isSuccess, @@ -22,8 +22,7 @@ module Maybes ( #include "HsVersions.h" -import Maybe - +import Data.Maybe infixr 4 `orElse` \end{code} diff --git a/compiler/utils/OrdList.lhs b/compiler/utils/OrdList.lhs index 7f22b38..7e797e0 100644 --- a/compiler/utils/OrdList.lhs +++ b/compiler/utils/OrdList.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1993-1998 % diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index 30960dc..db744b1 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -1,10 +1,10 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP Project, Glasgow University, 1992-1998 % -\section[Outputable]{Classes for pretty-printing} -Defines classes for pretty-printing and forcing, both forms of -``output.'' +Outputable: defines classes for pretty-printing and forcing, both +forms of ``output.'' \begin{code} @@ -62,10 +62,9 @@ import qualified Pretty import Pretty ( Doc, Mode(..) ) import Panic -import DATA_WORD ( Word32 ) - -import IO ( Handle, stderr, stdout, hFlush ) -import Char ( ord ) +import Data.Word ( Word32 ) +import System.IO ( Handle, stderr, stdout, hFlush ) +import Data.Char ( ord ) \end{code} diff --git a/compiler/utils/Panic.lhs b/compiler/utils/Panic.lhs index 1a74d5d..42bf8b5 100644 --- a/compiler/utils/Panic.lhs +++ b/compiler/utils/Panic.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP Project, Glasgow University, 1992-2000 % -\section{Panic error messages} Defines basic funtions for printing error messages. @@ -39,24 +39,15 @@ import Posix ( Handler(Catch), installHandler, sigINT, sigQUIT ) import GHC.ConsoleHandler #endif -# if __GLASGOW_HASKELL__ < 500 -import EXCEPTION ( raiseInThread ) -# else -import EXCEPTION ( throwTo ) -# endif /* GHC < 500 */ - -#if __GLASGOW_HASKELL__ > 408 -import EXCEPTION ( catchJust, tryJust, ioErrors ) -#endif - -import CONCURRENT ( myThreadId, MVar, ThreadId, withMVar, newEmptyMVar ) -import DYNAMIC -import qualified EXCEPTION as Exception -import TRACE ( trace ) -import UNSAFE_IO ( unsafePerformIO ) -import IO ( isUserError ) - -import System +import Control.Exception hiding (try) +import Control.Concurrent ( myThreadId, MVar, ThreadId, withMVar, newEmptyMVar ) +import Data.Dynamic +import qualified Control.Exception as Exception +import Debug.Trace ( trace ) +import System.IO.Unsafe ( unsafePerformIO ) +import System.IO.Error ( isUserError ) +import System.Exit +import System.Environment \end{code} GHC's own exception type. diff --git a/compiler/utils/Pretty.lhs b/compiler/utils/Pretty.lhs index ec8f1e7..31d65f2 100644 --- a/compiler/utils/Pretty.lhs +++ b/compiler/utils/Pretty.lhs @@ -180,12 +180,10 @@ module Pretty ( import BufWrite import FastString -import GLAEXTS +import GHC.Exts import Numeric (fromRat) -import IO - -import System.IO ( hPutBuf ) +import System.IO import GHC.Base ( unpackCString# ) import GHC.Ptr ( Ptr(..) ) diff --git a/compiler/utils/StringBuffer.lhs b/compiler/utils/StringBuffer.lhs index e52e7e7..8eb6fc2 100644 --- a/compiler/utils/StringBuffer.lhs +++ b/compiler/utils/StringBuffer.lhs @@ -1,7 +1,7 @@ % +% (c) The University of Glasgow 2006 % (c) The University of Glasgow, 1997-2006 % -\section{String buffers} Buffers for scanning string input stored in external arrays. diff --git a/compiler/utils/UniqFM.lhs b/compiler/utils/UniqFM.lhs index 2a02dc7..267aeab 100644 --- a/compiler/utils/UniqFM.lhs +++ b/compiler/utils/UniqFM.lhs @@ -1,7 +1,9 @@ -%ilter +% +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1994-1998 % -\section[UniqFM]{Specialised finite maps, for things with @Uniques@} + +UniqFM: Specialised finite maps, for things with @Uniques@ Based on @FiniteMaps@ (as you would expect). @@ -52,7 +54,7 @@ import Maybes ( maybeToBool ) import FastTypes import Outputable -import GLAEXTS -- Lots of Int# operations +import GHC.Exts -- Lots of Int# operations \end{code} %************************************************************************ diff --git a/compiler/utils/UniqSet.lhs b/compiler/utils/UniqSet.lhs index 129e333..7d83f6f 100644 --- a/compiler/utils/UniqSet.lhs +++ b/compiler/utils/UniqSet.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The AQUA Project, Glasgow University, 1994-1998 % \section[UniqSet]{Specialised sets, for things with @Uniques@} diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 522f795..3eff34b 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The University of Glasgow 1992-2002 % \section[Util]{Highly random utility functions} @@ -82,26 +83,26 @@ module Util ( import Panic ( panic, trace ) import FastTypes -import EXCEPTION ( Exception(..), finally, throwDyn, catchDyn, throw ) -import qualified EXCEPTION as Exception -import DYNAMIC ( Typeable ) -import DATA_IOREF ( IORef, newIORef ) -import UNSAFE_IO ( unsafePerformIO ) -import DATA_IOREF ( readIORef, writeIORef ) +import Control.Exception ( Exception(..), finally, catchDyn, throw ) +import qualified Control.Exception as Exception +import Data.Dynamic ( Typeable ) +import Data.IORef ( IORef, newIORef ) +import System.IO.Unsafe ( unsafePerformIO ) +import Data.IORef ( readIORef, writeIORef ) -import qualified List ( elem, notElem ) +import qualified Data.List as List ( elem, notElem ) #ifndef DEBUG -import List ( zipWith4 ) +import Data.List ( zipWith4 ) #endif -import Monad ( when ) -import IO ( catch, isDoesNotExistError ) -import Directory ( doesDirectoryExist, createDirectory ) -import Char ( isUpper, isAlphaNum, isSpace, ord, isDigit ) -import Ratio ( (%) ) -import Time ( ClockTime ) -import Directory ( getModificationTime ) +import Control.Monad ( when ) +import SYSTEM_IO_ERROR as IO ( catch, isDoesNotExistError ) +import System.Directory ( doesDirectoryExist, createDirectory, + getModificationTime ) +import Data.Char ( isUpper, isAlphaNum, isSpace, ord, isDigit ) +import Data.Ratio ( (%) ) +import System.Time ( ClockTime ) infixr 9 `thenCmp` \end{code} -- 1.7.10.4