Portability | GHC |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com, rtharper@aftereternity.co.uk, duncan@haskell.org |
Text manipulation functions represented as fusible operations over streams.
- data Stream a = forall s . Stream (s -> Step s a) !s !Int
- 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
- unfoldrN :: Int -> (a -> Maybe (Char, a)) -> a -> Stream Char
- index :: Stream Char -> Int -> Char
- findIndex :: (Char -> Bool) -> Stream Char -> Maybe Int
- findIndices :: (Char -> Bool) -> Stream Char -> [Int]
- findIndexOrEnd :: (Char -> Bool) -> Stream Char -> Int
- elemIndex :: Char -> Stream Char -> Maybe Int
- elemIndices :: Char -> Stream Char -> [Int]
- count :: Char -> Stream Char -> Int
Types
Creation and elimination
reverseStream :: Text -> Stream CharSource
O(n) Convert a Text
into a 'Stream Char', but iterate
backwards.
Transformations
Construction
Scans
reverseScanr :: (Char -> Char -> Char) -> Char -> Stream Char -> Stream CharSource
O(n) Perform the equivalent of scanr
over a list, only with
the input and result reversed.
Generation and unfolding
Indexing
findIndex :: (Char -> Bool) -> Stream Char -> Maybe IntSource
The findIndex
function takes a predicate and a stream and
returns the index of the first element in the stream
satisfying the predicate.
findIndices :: (Char -> Bool) -> Stream Char -> [Int]Source
The findIndices
function takes a predicate and a stream and
returns all indices of the elements in the stream
satisfying the predicate.
findIndexOrEnd :: (Char -> Bool) -> Stream Char -> IntSource
The findIndexOrEnd
function takes a predicate and a stream and
returns the index of the first element in the stream
satisfying the predicate.
elemIndices :: Char -> Stream Char -> [Int]Source
O(n) The elemIndices
function returns the index of every
element in the given stream which is equal to the query element.