Document Packages and a minor refactoring
[ghc-hetmet.git] / compiler / main / HeaderInfo.hs
index 10f714b..d0e30e0 100644 (file)
@@ -40,23 +40,12 @@ import Panic
 import Maybes
 import Bag             ( emptyBag, listToBag )
 
-import Control.Exception
+import Exception
 import Control.Monad
 import System.Exit
 import System.IO
 import Data.List
 
-#if !defined(__GLASGOW_HASKELL__) || __GLASGOW_HASKELL__ >= 601
-  -- already imported above
---import System.IO             ( openBinaryFile )
-#else
-import IOExts                   ( openFileEx, IOModeEx(..) )
-#endif
-
-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 601
-openBinaryFile fp mode = openFileEx fp (BinaryMode mode)
-#endif
-
 getImports :: DynFlags -> StringBuffer -> FilePath -> FilePath
     -> IO ([Located ModuleName], [Located ModuleName], Located ModuleName)
 getImports dflags buf filename source_filename = do
@@ -81,7 +70,7 @@ getImports dflags buf filename source_filename = do
              return (source_imps, ordinary_imps, mod)
   
 parseError :: SrcSpan -> Message -> a
-parseError span err = throwDyn $ mkPlainErrMsg span err
+parseError span err = throwErrMsg $ mkPlainErrMsg span err
 
 isSourceIdecl :: ImportDecl name -> Bool
 isSourceIdecl (ImportDecl _ s _ _ _) = s
@@ -98,7 +87,7 @@ getOptionsFromFile :: DynFlags
                    -> FilePath            -- input file
                    -> IO [Located String] -- options, if any
 getOptionsFromFile dflags filename
-    = Control.Exception.bracket
+    = Exception.bracket
              (openBinaryFile filename ReadMode)
               (hClose)
               (\handle ->
@@ -192,7 +181,7 @@ getOptions' dflags buf filename
 
 checkProcessArgsResult :: [String] -> FilePath -> IO ()
 checkProcessArgsResult flags filename
-  = do when (notNull flags) (throwDyn (ProgramError (
+  = do when (notNull flags) (ghcError (ProgramError (
           showSDoc (hang (text filename <> char ':')
                       4 (text "unknown flags in  {-# OPTIONS #-} pragma:" <+>
                           hsep (map text flags)))