attoparsec-0.14.4: Fast combinator parsing for bytestrings and text

Copyright | Bryan O'Sullivan 2007-2015
License | BSD3
Maintainer | bos@serpentine.com
Stability | experimental
Portability | GHC
Safe Haskell | None
Language | Haskell2010

Data.Attoparsec.Text.Buffer

Description

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

data Buffer Source #

#### Instances

Instances details

Monoid Buffer Source # |
Instance details Defined in Data.Attoparsec.Text.Buffer Methods mempty :: Buffer Source # mappend :: Buffer -> Buffer -> Buffer Source # mconcat :: [Buffer] -> Buffer Source #
Semigroup Buffer Source # |
Instance details Defined in Data.Attoparsec.Text.Buffer Methods (<>) :: Buffer -> Buffer -> Buffer Source # sconcat :: NonEmpty Buffer -> Buffer Source # stimes :: Integral b => b -> Buffer -> Buffer Source #
Show Buffer Source # |
Instance details Defined in Data.Attoparsec.Text.Buffer Methods showsPrec :: Int -> Buffer -> ShowS Source # show :: Buffer -> String Source # showList :: [Buffer] -> ShowS Source #

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.

unbuffer :: Buffer -> Text Source #

unbufferAt :: Int -> Buffer -> Text Source #

length :: Buffer -> Int Source #

pappend :: Buffer -> Text -> Buffer Source #

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.

substring :: Int -> Int -> Buffer -> Text Source #

lengthCodeUnits :: Text -> Int Source #

dropCodeUnits :: Int -> Buffer -> Text Source #