git.iko.soy/typeable/pandoc
on master help sign in
Avoid incomplete pattern patch.
commit1e0439710b0bbc54e9e4fa4f9f88ecc4e15b7c5a authorJohn MacFarlane <jgm@berkeley.edu> dateFri 10 Aug 2018, 22:10 (8 years ago) parent55047b4
1 file changed+8−5
src/Text/Pandoc/Parsing.hs+8−5
src/Text/Pandoc/Parsing.hs+8−5
@@ -518,11 +518,14 @@ charsInBalanced open close parser = try $ do
518518romanNumeral :: Stream s m Char => Bool -- ^ Uppercase if true
519519 -> ParserT s st m Int
520520romanNumeral upperCase = do
521− let [one, five, ten, fifty, hundred, fivehundred, thousand] =
522− map char $
523− if upperCase
524− then ['I','V','X','L','C','D','M']
525− else ['i','v','x','l','c','d','m']
521+ let rchar uc = char $ if upperCase then uc else toLower uc
522+ let one = rchar 'I'
523+ let five = rchar 'V'
524+ let ten = rchar 'X'
525+ let fifty = rchar 'L'
526+ let hundred = rchar 'C'
527+ let fivehundred = rchar 'D'
528+ let thousand = rchar 'M'
526529 lookAhead $ choice [one, five, ten, fifty, hundred, fivehundred, thousand]
527530 thousands <- ((1000 *) . length) <$> many thousand
528531 ninehundreds <- option 0 $ try $ hundred >> thousand >> return 900