diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-08-10 22:10:07 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-08-10 22:10:07 -0700 |
commit | 1e0439710b0bbc54e9e4fa4f9f88ecc4e15b7c5a (patch) | |
tree | 59f907cee9fac5275a1692e715e161d1ba90dc85 /src/Text | |
parent | 55047b4919c8a2abe8885beb35b280b708b12b10 (diff) | |
download | pandoc-1e0439710b0bbc54e9e4fa4f9f88ecc4e15b7c5a.tar.gz |
Avoid incomplete pattern patch.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index cab18b645..5d95d0e27 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -518,11 +518,14 @@ charsInBalanced open close parser = try $ do romanNumeral :: Stream s m Char => Bool -- ^ Uppercase if true -> ParserT s st m Int romanNumeral upperCase = do - let [one, five, ten, fifty, hundred, fivehundred, thousand] = - map char $ - if upperCase - then ['I','V','X','L','C','D','M'] - else ['i','v','x','l','c','d','m'] + let rchar uc = char $ if upperCase then uc else toLower uc + let one = rchar 'I' + let five = rchar 'V' + let ten = rchar 'X' + let fifty = rchar 'L' + let hundred = rchar 'C' + let fivehundred = rchar 'D' + let thousand = rchar 'M' lookAhead $ choice [one, five, ten, fifty, hundred, fivehundred, thousand] thousands <- ((1000 *) . length) <$> many thousand ninehundreds <- option 0 $ try $ hundred >> thousand >> return 900 |