toChunks
O(n) Convert a lazy
Text into a list of strict
Texts.
O(c) Convert a byte stream into a stream of individual strict
bytestrings. This of course exposes the internal chunk structure.
This routine exposes the inner structure of the lazy number.
Chunk a non-negative integer into words, least significatn first
The raw
Text data that the
Rope is built from
>>> toChunks "echo hello world" & Stdio.putChunks
hello world
Pre-release
The following code is equivalent to the shell command
echo "hello
world":
>>> :{
Process.toChunks "echo" ["hello world"]
& Stream.fold Stdio.writeChunks
:}
hello world
>>> toChunks = toChunksWith id
Like
toChunks but use the specified configuration to run the
process.
Like
toBytesEither but generates a stream of
Array
Word8 instead of a stream of
Word8.
>>> :{
toChunksEither "bash" ["-c", "echo 'hello'; echo 'world' 1>&2"]
& Stream.fold (Fold.partition Stdio.writeErrChunks Stdio.writeChunks)
:}
world
hello
((),())
>>> toChunksEither = toChunksEitherWith id
Prefer
toChunksEither over
toBytesEither when
performance matters.
Pre-release
Like
toChunksEither but use the specified configuration to run
the process.
Like
toChunks but use the specified configuration to run the
process.
Split
Pandoc into
Chunks, e.g. for conversion into a set
of HTML pages or EPUB chapters.
Variant of
reverseCommitsOntoChunks that does not reverse the
order of the commits. Since commits are built backwards by consing,
this means that the chunks appended to the front will be backwards.
Within each chunk, however, the bytes will be in the correct order.
Unlike
reverseCommitsOntoChunks, this function is not tail
recursive.
Cons the chunks from a list of Commits onto an initial
Chunks list (this argument is often ChunksNil). This
reverses the order of the chunks, which is desirable since builders
assemble Commits with the chunks backwards. This performs an
in-place shrink and freezes any mutable byte arrays it encounters.
Consequently, these must not be reused.