lines package:yi-rope
This is like
lines' but it does *not* preserve newlines.
Specifically, we just strip the newlines from the result of
lines'.
This behaves slightly differently than the old split: the number of
resulting strings here is equal to the number of newline characters in
the underlying string. This is much more consistent than the old
behaviour which blindly used
ByteStrings split and stitched
the result back together which was inconsistent with the rest of the
interface which worked with number of newlines.
Splits the
YiString into a list of
YiString each
containing a line.
Note that in old implementation this allowed an arbitrary character to
split on. If you want to do that, manually convert
toText and
use
splitOn to suit your needs. This case is optimised for
newlines only which seems to have been the only use of the original
function.
The newlines are preserved so this should hold:
'toText' . 'concat' . 'lines'' ≡ 'toText'
but the underlying structure might change: notably, chunks will most
likely change sizes.
Count the number of newlines in the underlying string. This is
actually amortized constant time as we cache this information in the
underlying tree.
Joins up lines by a newline character. It does not leave a newline
after the last line. If you want a more classical
unlines
behaviour, use
map along with
snoc.