From 1e0439710b0bbc54e9e4fa4f9f88ecc4e15b7c5a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 10 Aug 2018 22:10:07 -0700 Subject: Avoid incomplete pattern patch. --- src/Text/Pandoc/Parsing.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3