-- | Chomps trailing blank space off of a 'Doc'.
chomp :: Doc -> Doc
chomp d = Doc (fromList dl')
  where dl = toList (unDoc d)
        dl' = reverse $ dropWhile removeable $ reverse dl
        removeable BreakingSpace = True
        removeable CarriageReturn = True
        removeable NewLine = True
        removeable BlankLine = True
        removeable _ = False
chomp :: Doc -> Doc
chomp d = Doc (fromList dl')
  where dl = toList (unDoc d)
        dl' = reverse $ dropWhile removeable $ reverse dl
        removeable BreakingSpace = True
        removeable CarriageReturn = True
        removeable NewLine = True
        removeable BlankLine = True
        removeable _ = False
chomp d = Doc (fromList dl')
  where dl = toList (unDoc d)
        dl' = reverse $ dropWhile removeable $ reverse dl
        removeable BreakingSpace = True
        removeable CarriageReturn = True
        removeable NewLine = True
        removeable BlankLine = True
        removeable _ = False