Skip to content

Commit

Permalink
Avoid reversing
Browse files Browse the repository at this point in the history
This reverts commit c805a01.
  • Loading branch information
sjakobi authored and quchen committed Nov 5, 2019
1 parent 6c525e3 commit 01d05aa
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1465,13 +1465,11 @@ removeTrailingWhitespace = go (RecordedWhitespace [] 0)
-> Int -- Withheld spaces
-> SimpleDocStream ann
-> SimpleDocStream ann
commitSpaces is0 n0 = commitSpaces' (reverse is0) n0
where
commitSpaces' [] 0 = id
commitSpaces' [] 1 = SChar ' '
commitSpaces' [] n = SText n (T.replicate n " ")
commitSpaces' [i] n = SLine i . commitSpaces' [] n
commitSpaces' (_:is) n = SLine 0 . commitSpaces' is n
commitSpaces [] 0 = id
commitSpaces [] 1 = SChar ' '
commitSpaces [] n = SText n (T.replicate n " ")
commitSpaces [i] n = SLine i . commitSpaces [] n
commitSpaces (i:is) n = commitSpaces (map (const 0) is) 0 . SLine i . commitSpaces [] n

go :: WhitespaceStrippingState -> SimpleDocStream ann -> SimpleDocStream ann
-- We do not strip whitespace inside annotated documents, since it might
Expand Down

0 comments on commit 01d05aa

Please sign in to comment.