aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App/FormatHeuristics.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-07-14 10:48:38 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-07-14 10:48:38 -0700
commited0548d8983d0e2a3bd50602d166837b13e31a85 (patch)
treef8ede30a77b9aa50bb17235537897f72c55dafa2 /src/Text/Pandoc/App/FormatHeuristics.hs
parent968d2046a3cb6db661673be580660ac402753c34 (diff)
downloadpandoc-ed0548d8983d0e2a3bd50602d166837b13e31a85.tar.gz
Change formatForFilePaths to return a Maybe.
Internal change. This will make it easier to emit messages when we're guessing at a format.
Diffstat (limited to 'src/Text/Pandoc/App/FormatHeuristics.hs')
-rw-r--r--src/Text/Pandoc/App/FormatHeuristics.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/App/FormatHeuristics.hs b/src/Text/Pandoc/App/FormatHeuristics.hs
index 6198e83dc..a02d8d15e 100644
--- a/src/Text/Pandoc/App/FormatHeuristics.hs
+++ b/src/Text/Pandoc/App/FormatHeuristics.hs
@@ -18,13 +18,13 @@ import Prelude
import Data.Char (toLower)
import System.FilePath (takeExtension)
--- Determine default reader based on source file extensions.
-formatFromFilePaths :: String -> [FilePath] -> String
-formatFromFilePaths fallback [] = fallback
-formatFromFilePaths fallback (x:xs) =
+-- Determine default format based on file extensions.
+formatFromFilePaths :: [FilePath] -> Maybe String
+formatFromFilePaths [] = Nothing
+formatFromFilePaths (x:xs) =
case formatFromFilePath x of
- Just f -> f
- Nothing -> formatFromFilePaths fallback xs
+ Just f -> Just f
+ Nothing -> formatFromFilePaths xs
-- Determine format based on file extension
formatFromFilePath :: FilePath -> Maybe String