diff options
author | Ben Gamari <ben@smart-cactus.org> | 2016-01-06 14:35:00 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-01-06 14:35:00 +0100 |
commit | a13d21c688cae176be4505a5a6e9d64739845ea3 (patch) | |
tree | b46e2ca15cf3ca46bd2ce0ab2329e9969608667c /driver/Main.hs | |
parent | 6ddd758be0e7b50bd19d33400b3c3013d60786cb (diff) | |
parent | 13e1eaf3ca897ffcf1b37d96e2867bc80d4ca64a (diff) |
Merge branch 'master' into ghc-head
Diffstat (limited to 'driver/Main.hs')
-rw-r--r-- | driver/Main.hs | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/driver/Main.hs b/driver/Main.hs index ccbb8b7d..852f44c7 100644 --- a/driver/Main.hs +++ b/driver/Main.hs @@ -1,29 +1,8 @@ -{-# LANGUAGE ScopedTypeVariables #-} module Main where -import Control.Exception import Documentation.Haddock (haddock) +import ResponseFile (expandResponse) import System.Environment (getArgs) -import System.Exit (exitFailure) -import System.IO main :: IO () main = getArgs >>= expandResponse >>= haddock - - --- | Arguments which look like '@foo' will be replaced with the --- contents of file @foo@. The contents will be passed through 'words' --- and blanks filtered out first. --- --- We quit if the file is not found or reading somehow fails. -expandResponse :: [String] -> IO [String] -expandResponse = fmap concat . mapM expand - where - expand :: String -> IO [String] - expand ('@':f) = readFileExc f >>= return . filter (not . null) . lines - expand x = return [x] - - readFileExc f = - readFile f `catch` \(e :: IOException) -> do - hPutStrLn stderr $ "Error while expanding response file: " ++ show e - exitFailure |