Portability | GHC |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com, rtharper@aftereternity.co.uk, duncan@haskell.org |
Data.Text.Lazy.Fusion
Description
Core stream fusion functionality for text.
- stream :: Text -> Stream Char
- unstream :: Stream Char -> Text
- unstreamChunks :: Int -> Stream Char -> Text
- length :: Stream Char -> Int64
- unfoldrN :: Int64 -> (a -> Maybe (Char, a)) -> a -> Stream Char
- index :: Stream Char -> Int64 -> Char
- findIndex :: (Char -> Bool) -> Stream Char -> Maybe Int64
- findIndices :: (Char -> Bool) -> Stream Char -> [Int64]
- elemIndex :: Char -> Stream Char -> Maybe Int64
- elemIndices :: Char -> Stream Char -> [Int64]
- count :: Char -> Stream Char -> Int64
Documentation
unstream :: Stream Char -> TextSource
O(n) Convert a 'Stream Char' into a Text
, using
defaultChunkSize
.
unstreamChunks :: Int -> Stream Char -> TextSource
O(n) Convert a 'Stream Char' into a Text
, using the given
chunk size.
unfoldrN :: Int64 -> (a -> Maybe (Char, a)) -> a -> Stream CharSource
O(n) Like unfoldr
, unfoldrN64
builds a stream from a seed
value. However, the length of the result is limited by the
first argument to unfoldrN64
. This function is more efficient than
unfoldr
when the length of the result is known.
findIndex :: (Char -> Bool) -> Stream Char -> Maybe Int64Source
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 -> [Int64]Source
The findIndices
function takes a predicate and a stream and
returns all indices of the elements in the stream
satisfying the predicate.
elemIndices :: Char -> Stream Char -> [Int64]Source
O(n) The elemIndices
function returns the index of every
element in the given stream which is equal to the query element.