Copyright | (c) Tom Harper 2008-2009 (c) Bryan O'Sullivan 2009-2010 (c) Duncan Coutts 2009 |
---|---|
License | BSD-style |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell98 |
Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!
Text manipulation functions represented as fusible operations over streams.
- data Stream a = Stream (s -> Step s a) !s !Size
- data Step s a
- stream :: Text -> Stream Char
- unstream :: Stream Char -> Text
- reverseStream :: Text -> Stream Char
- length :: Stream Char -> Int
- reverse :: Stream Char -> Text
- reverseScanr :: (Char -> Char -> Char) -> Char -> Stream Char -> Stream Char
- mapAccumL :: (a -> Char -> (a, Char)) -> a -> Stream Char -> (a, Text)
- unfoldrN :: Int -> (a -> Maybe (Char, a)) -> a -> Stream Char
- index :: Stream Char -> Int -> Char
- findIndex :: (Char -> Bool) -> Stream Char -> Maybe Int
- countChar :: Char -> Stream Char -> Int
Types
Creation and elimination
reverseStream :: Text -> Stream Char Source #
O(n) Convert a Text
into a 'Stream Char', but iterate
backwards.
Transformations
Construction
Scans
reverseScanr :: (Char -> Char -> Char) -> Char -> Stream Char -> Stream Char Source #
O(n) Perform the equivalent of scanr
over a list, only with
the input and result reversed.
Accumulating maps
Generation and unfolding
Indexing
index :: Stream Char -> Int -> Char Source #
O(n) stream index (subscript) operator, starting from 0.