Copyright | (c) Tom Harper 2008-2009 (c) Bryan O'Sullivan 2009-2010 (c) Duncan Coutts 2009 |
---|---|
License | BSD-style |
Maintainer | [email protected] |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
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.
Eq a => Eq (Stream a) | |
Ord a => Ord (Stream a) | |
Defined in Data.Text.Internal.Fusion.Types |
Intermediate result in a processing pipeline.
stream :: Text -> Stream Char Source
O(n) Convert a Text
into a 'Stream Char'.
unstream :: Stream Char -> Text Source
O(n) Convert a 'Stream Char' into a Text
.
reverseStream :: Text -> Stream Char Source
O(n) Convert a Text
into a 'Stream Char', but iterate backwards.
length :: Stream Char -> Int Source
reverse :: Stream Char -> Text Source
O(n) Reverse the characters of a string.
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.
mapAccumL :: (a -> Char -> (a, Char)) -> a -> Stream Char -> (a, Text) Source
O(n) Like a combination of map
and foldl'
. Applies a function to each element of a Text
, passing an accumulating parameter from left to right, and returns a final Text
.
unfoldrN :: Int -> (a -> Maybe (Char, a)) -> a -> Stream Char Source
O(n) Like unfoldr
, unfoldrN
builds a stream from a seed value. However, the length of the result is limited by the first argument to unfoldrN
. This function is more efficient than unfoldr
when the length of the result is known.
index :: Stream Char -> Int -> Char Source
O(n) stream index (subscript) operator, starting from 0.
findIndex :: (Char -> Bool) -> Stream Char -> Maybe Int Source
The findIndex
function takes a predicate and a stream and returns the index of the first element in the stream satisfying the predicate.
countChar :: Char -> Stream Char -> Int Source
O(n) The count
function returns the number of times the query element appears in the given stream.
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/text-1.2.4.0/Data-Text-Internal-Fusion.html