lines package:streamly-core

Break a string up into a stream of strings at newline characters. The resulting strings do not contain newlines.
lines = S.lines A.write
>>> Stream.fold Fold.toList $ Unicode.lines $ Stream.fromList "lines\nthis\nstring\n\n\n"
[fromList "lines",fromList "this",fromList "string",fromList "",fromList ""]
Fold each line of the stream using the supplied Fold and stream the result.
>>> Stream.fold Fold.toList $ Unicode.lines Fold.toList (Stream.fromList "lines\nthis\nstring\n\n\n")
["lines","this","string","",""]
lines = Stream.splitOnSuffix (== '\n')
Pre-release
How should we inline the serialize function? The default 'Just Inline'. However, aggressive inlining can bloat the code and increase in compilation times when there are big functions and too many nesting levels so you can change it accordingly. A Nothing value leaves the decision to the compiler.
Flattens the stream of Array Char, after appending a terminating newline to each string. unlines is an inverse operation to lines.
>>> Stream.fold Fold.toList $ Unicode.unlines $ Stream.fromList ["lines", "this", "string"]
"lines\nthis\nstring\n"
unlines = S.unlines A.read
Note that, in general
unlines . lines /= id
Unfold a stream to character streams using the supplied Unfold and concat the results suffixing a newline character \n to each stream.
unlines = Stream.interposeSuffix 'n'
unlines = Stream.intercalateSuffix Unfold.fromList "n"
Pre-release