diff options
author | Ben Gamari <ben@smart-cactus.org> | 2016-01-06 13:47:17 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-01-06 13:47:17 +0100 |
commit | 94c127449fd25732ebda04a472cc5d99b4ce6481 (patch) | |
tree | fd751b7b5d15a4859d2e90700cce76817af680cd /driver/Main.hs | |
parent | 116e56e201e2efb52e9ade07deecbcf5f3106719 (diff) | |
parent | d510c45790432249fe7027b1ed70ce1c06fdd824 (diff) |
Merge remote-tracking branch 'randen/bug468'
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 |