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 | Safe-Inferred |
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.
Synopsis
- data Stream a = forall s. Stream (s -> Step s a) !s !Size
- data Step s a
- stream :: Text -> Stream Char
- streamLn :: 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 :: HasCallStack => Stream Char -> Int -> Char
- findIndex :: (Char -> Bool) -> Stream Char -> Maybe Int
- countChar :: Char -> Stream Char -> Int
Types
A co-recursive type yielding a single element at a time depending on the internal state it carries.
Creation and elimination
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.
Properties
reverse
.reverseScanr
f c .reverseStream
=scanr
f c