Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Stream a = Stream (s -> Step s a) !s !Size
- data Step s a
- stream :: JSString -> Stream Char
- unstream :: Stream Char -> JSString
- reverseStream :: JSString -> Stream Char
- length :: Stream Char -> Int
- reverse :: Stream Char -> JSString
- reverseScanr :: (Char -> Char -> Char) -> Char -> Stream Char -> Stream Char
- mapAccumL :: (a -> Char -> (a, Char)) -> a -> Stream Char -> (a, JSString)
- 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
A co-recursive type yielding a single element at a time depending on the internal state it carries.
Creation and elimination
reverseStream :: JSString -> Stream Char Source #
O(n) Convert a JSString
into a 'Stream Char', but iterate
backwards.
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.
Accumulating maps
Generation and unfolding
Indexing
index :: Stream Char -> Int -> Char Source #
O(n) stream index (subscript) operator, starting from 0.