diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-10-27 21:11:26 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-10-27 21:11:26 -0700 |
commit | be7a29e9b95bb8ffa77c3ffeb49e7cf6ba164ed4 (patch) | |
tree | 1f4a86429b9202589c54bbe12157dd4c1d755c94 /src/Text | |
parent | e77d08e439e727111b05a832531fdf86d03d2436 (diff) | |
download | pandoc-be7a29e9b95bb8ffa77c3ffeb49e7cf6ba164ed4.tar.gz |
hlint suggestions.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/App.hs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index ed9992911..e965771b7 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -112,8 +112,9 @@ parseOptions options' defaults = do let (actions, args, unrecognizedOpts, errors) = getOpt' Permute options' rawArgs - let unknownOptionErrors = foldr handleUnrecognizedOption [] $ - map (takeWhile (/= '=')) unrecognizedOpts + let unknownOptionErrors = + foldr (handleUnrecognizedOption . (takeWhile (/= '='))) [] + unrecognizedOpts unless (null errors && null unknownOptionErrors) $ E.throwIO $ PandocOptionError $ @@ -205,12 +206,10 @@ convertWithOpts opts = do Just _ -> return $ optDataDir opts -- assign reader and writer based on options and filenames - let readerName = case optReader opts of - Nothing -> defaultReaderName - (if any isURI sources - then "html" - else "markdown") sources - Just x -> x + let readerName = fromMaybe ( defaultReaderName + (if any isURI sources + then "html" + else "markdown") sources) (optReader opts) let nonPdfWriterName Nothing = defaultWriterName outputFile nonPdfWriterName (Just x) = x @@ -286,7 +285,7 @@ convertWithOpts opts = do #else istty <- queryTerminal stdOutput #endif - when (not (isTextFormat format) && istty && optOutputFile opts == Nothing) $ + when (not (isTextFormat format) && istty && isNothing ( optOutputFile opts)) $ E.throwIO $ PandocAppError $ "Cannot write " ++ format ++ " output to terminal.\n" ++ "Specify an output file using the -o option, or " ++ |