@@ -190,12 +190,14 @@ vsep = foldr ($+$) empty
190190chomp :: Doc -> Doc
191191chomp d = Doc (fromList dl')
192192 where dl = toList (unDoc d)
193− dl' = reverse $ dropWhile removeable $ reverse dl
194− removeable BreakingSpace = True
195− removeable CarriageReturn = True
196− removeable NewLine = True
197− removeable BlankLine = True
198− removeable _ = False
193+ dl' = reverse $ go $ reverse dl
194+ go [] = []
195+ go (BreakingSpace : xs) = go xs
196+ go (CarriageReturn : xs) = go xs
197+ go (NewLine : xs) = go xs
198+ go (BlankLine : xs) = go xs
199+ go (Prefixed s d' : xs) = Prefixed s (chomp d') : xs
200+ go xs = xs
199201
200202outp :: (IsString a, Monoid a)
201203 => Int -> String -> DocState a