Rope -is:module

Rope of Text chunks with logarithmic concatenation. This rope offers three interfaces: one based on code points, one based on UTF-16 code units, and one based on UTF-8 code units. This comes with a price of more bookkeeping and is less performant than Data.Text.Rope, Data.Text.Utf8.Rope, or Data.Text.Utf16.Rope.
Rope of Text chunks with logarithmic concatenation. This rope offers an interface, based on code points. Use Data.Text.Utf16.Rope, if you need UTF-16 code units, or Data.Text.Mixed.Rope, if you need both interfaces.
Rope of Text chunks with logarithmic concatenation. This rope offers an interface, based on UTF-16 code units. Use Data.Text.Rope, if you need code points, or Data.Text.Mixed.Rope, if you need both interfaces.
Rope of Text chunks with logarithmic concatenation. This rope offers an interface, based on UTF-8 code units. Use Data.Text.Rope, if you need code points, or Data.Text.Mixed.Rope, if you need both interfaces.
A type for textual data. A rope is text backed by a tree data structure, rather than a single large continguous array, as is the case for strings. There are three use cases: Referencing externally sourced data Often we interpret large blocks of data sourced from external systems as text. Ideally we would hold onto this without copying the memory, but (as in the case of ByteString which is the most common source of data) before we can treat it as text we have to validate the UTF-8 content. Safety first. We also copy it out of pinned memory, allowing the Haskell runtime to manage the storage. Interoperating with other libraries The only constant of the Haskell universe is that you won't have the right combination of {strict, lazy} × {Text, ByteString, String, [Word8], etc} you need for the next function call. The Textual typeclass provides for moving between different text representations. To convert between Rope and something else use fromRope; to construct a Rope from textual content in another type use intoRope. You can get at the underlying finger tree with the unRope function. Assembling text to go out This involves considerable appending of data, very very occaisionally inserting it. Often the pieces are tiny. To add text to a Rope use the appendRope method as below or the (<>) operator from Data.Monoid (like you would have with a Builder). Output to a Handle can be done efficiently with hWrite.
A SplayTree of Text values optimised for being indexed by and modified at UTF-16 code units and row/column (RowColumn) positions. Internal invariant: No empty Chunks in the SplayTree
A SplayTree of Text values optimised for being indexed by and modified at UTF-16 code units and row/column (RowColumn) positions. Internal invariant: No empty Chunks in the SplayTree
Not on Stackage, so not searched. Tools for manipulating fingertrees of bytestrings with optional annotations
Construct a Rope out of a single ByteString strand.
Ropes optimised for updating using UTF-16 code units and row/column pairs. Ropes optimised for updating using UTF-16 code units and row/column pairs. This implementation uses splay trees instead of the usual finger trees. According to my benchmarks, splay trees are faster in most situations.
The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f, and:
  • n is an integral number with the same sign as x; and
  • f is a fraction with the same type and sign as x, and with absolute value less than 1.
The default definitions of the ceiling, floor, truncate and round functions are in terms of properFraction.
O(1) dropEnd n xs is equivalent to take (length xs - n) xs. Drops n elements from end of bytestring.
>>> dropEnd 3 "abcdefg"
"abcd"

>>> dropEnd 0 "abcdefg"
"abcdefg"

>>> dropEnd 4 "abc"
""