Copyright | Bryan O'Sullivan 2007-2015 |
---|---|
License | BSD3 |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
An immutable buffer that supports cheap appends.
Synopsis
- data Buffer
- buffer :: Text -> Buffer
- unbuffer :: Buffer -> Text
- unbufferAt :: Int -> Buffer -> Text
- length :: Buffer -> Int
- pappend :: Buffer -> Text -> Buffer
- iter :: Buffer -> Int -> Iter
- iter_ :: Buffer -> Int -> Int
- substring :: Int -> Int -> Buffer -> Text
- lengthCodeUnits :: Text -> Int
- dropCodeUnits :: Int -> Buffer -> Text
Documentation
buffer :: Text -> Buffer Source #
The initial Buffer
has no mutable zone, so we can avoid all
copies in the (hopefully) common case of no further input being fed
to us.
iter :: Buffer -> Int -> Iter Source #
O(1) Iterate (unsafely) one step forwards through a UTF-8 array, returning the current character and the delta to add to give the next offset to iterate at.
iter_ :: Buffer -> Int -> Int Source #
O(1) Iterate one step through a UTF-8 array, returning the delta to add to give the next offset to iterate at.
lengthCodeUnits :: Text -> Int Source #