Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- stripSpace :: Text -> Text
Documentation
stripSpace :: Text -> Text Source #
A (quite possibly inefficient) re-implementation of git stripspace
. This
function normalizes a Text
buffer to conform to the following rules:
- All trailing white space is stripped.
- Empty lines at the beginning or at the end of the buffer are stripped.
- Consecutive empty lines between paragraphs are collapsed into one.
\r\n
line endings are normalized into\n
.- If the buffer is not empty, then its last line is terminated by
\n
. - If the buffer is empty (i.e. it contains only white space), then it comes out as the empty string.