Reducing CompactStrings (folds)

foldl, applied to a binary operator, a starting value (typically
the left-identity of the operator), and a CompactString, reduces the
CompactString using the binary operator, from left to right.
This function is subject to array fusion.

foldl1 is a variant of foldl that has no starting value
argument, and thus must be applied to non-empty CompactString.
This function is subject to array fusion.
An exception will be thrown in the case of an empty CompactString.

Accumulating maps

The mapAccumL function behaves like a combination of map and
foldl; it applies a function to each element of a CompactString,
passing an accumulating parameter from left to right, and returning a
final value of this accumulator together with the new CompactString.

The mapAccumR function behaves like a combination of map and
foldr; it applies a function to each element of a CompactString,
passing an accumulating parameter from right to left, and returning a
final value of this accumulator together with the new CompactString.

O(n), where n is the length of the result. The unfoldr
function is analogous to the List 'unfoldr'. unfoldr builds a
ByteString from a seed value. The function takes the element and
returns Nothing if it is done producing the CompactString or returns
Just(a,b), in which case, a is the next byte in the string,
and b is the seed value for further production.

O(n) Like unfoldr, unfoldrN builds a ByteString from a seed
value. However, the length of the result is limited by the first
argument to unfoldrN. This function is more efficient than unfoldr
when the maximum length of the result is known.

The group function takes a CompactString and returns a list of
CompactStrings such that the concatenation of the result is equal to the
argument. Moreover, each sublist in the result contains only equal
elements. For example,

group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]

It is a special case of groupBy, which allows the programmer to
supply their own equality test.

O(n) Splits a CompactString into components delimited by
separators, where the predicate returns True for a separator element.
The resulting components do not contain the separators. Two adjacent
separators result in an empty component in the output. eg.

Zipping and unzipping CompactStrings

O(n)zip takes two ByteStrings and returns a list of
corresponding pairs of bytes. If one input ByteString is short,
excess elements of the longer ByteString are discarded. This is
equivalent to a pair of unpack operations.

zipWith generalises zip by zipping with the function given as
the first argument, instead of a tupling function. For example,
zipWith (+) is applied to two ByteStrings to produce the list of
corresponding sums.

A specialised version of zipWith for the common case of a
simultaneous map over two CompactStrings, to build a 3rd. Rewrite rules
are used to automatically covert zipWith into zipWith' when a pack is
performed on the result of zipWith, but we also export it for
convenience.

The interact function takes a function of type CompactString -> CompactString
as its argument. The entire input from the standard input device is passed
to this function as its argument, and the resulting string is output on the
standard output device. It's great for writing one line programs!

The encoding of the file is determined based on a Byte Order Mark.
If the file is empty, it is written using UTF-16 with a Byte Order Mark.
If the encoding can not be determined the file is assumed to be UTF-8.