projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make package.conf files a bit more readable
[ghc-hetmet.git]
/
utils
/
ghc-pkg
/
Main.hs
diff --git
a/utils/ghc-pkg/Main.hs
b/utils/ghc-pkg/Main.hs
index
19be560
..
4b37684
100644
(file)
--- a/
utils/ghc-pkg/Main.hs
+++ b/
utils/ghc-pkg/Main.hs
@@
-34,18
+34,10
@@
import Prelude
#include "../../includes/ghcconfig.h"
#include "../../includes/ghcconfig.h"
-#if __GLASGOW_HASKELL__ >= 504
import System.Console.GetOpt
import Text.PrettyPrint
import qualified Control.Exception as Exception
import Data.Maybe
import System.Console.GetOpt
import Text.PrettyPrint
import qualified Control.Exception as Exception
import Data.Maybe
-#else
-import GetOpt
-import Pretty
-import qualified Exception
-import Maybe
-#endif
-
import Data.Char ( isSpace )
import Monad
import Directory
import Data.Char ( isSpace )
import Monad
import Directory
@@
-53,21
+45,12
@@
import System ( getArgs, getProgName, getEnv,
exitWith, ExitCode(..)
)
import System.IO
exitWith, ExitCode(..)
)
import System.IO
-#if __GLASGOW_HASKELL__ >= 600
import System.IO.Error (try)
import System.IO.Error (try)
-#else
-import System.IO (try)
-#endif
import Data.List ( isPrefixOf, isSuffixOf, intersperse, sortBy )
#ifdef mingw32_HOST_OS
import Foreign
import Data.List ( isPrefixOf, isSuffixOf, intersperse, sortBy )
#ifdef mingw32_HOST_OS
import Foreign
-
-#if __GLASGOW_HASKELL__ >= 504
import Foreign.C.String
import Foreign.C.String
-#else
-import CString
-#endif
#endif
import IO ( isPermissionError, isDoesNotExistError )
#endif
import IO ( isPermissionError, isDoesNotExistError )
@@
-658,7
+641,9
@@
writeNewConfig filename packages = do
if isPermissionError e
then die (filename ++ ": you don't have permission to modify this file")
else ioError e
if isPermissionError e
then die (filename ++ ": you don't have permission to modify this file")
else ioError e
- hPutStrLn h (show packages)
+ let shown = concat $ intersperse ",\n " $ map show packages
+ fileContents = "[" ++ shown ++ "\n]"
+ hPutStrLn h fileContents
hClose h
hPutStrLn stdout "done."
hClose h
hPutStrLn stdout "done."