@@ -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