Portability | GHC |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com, rtomharper@googlemail.com, duncan@haskell.org |
Safe Haskell | Safe-Infered |
Data.Text.Fusion
Contents
Description
Text manipulation functions represented as fusible operations over streams.
- data Stream a = forall s . 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 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.