ghcjs-base-stub-0.3.0.2: Allow GHCJS projects to compile under GHC and develop using intero.

Safe HaskellNone
LanguageHaskell2010

Data.JSString.Internal.Fusion

Contents

Synopsis

Types

data Stream a where #

Constructors

Stream :: forall a s. (s -> Step s a) -> !s -> !Size -> Stream a 
Instances
Eq a => Eq (Stream a) 
Instance details

Defined in Data.Text.Internal.Fusion.Types

Methods

(==) :: Stream a -> Stream a -> Bool #

(/=) :: Stream a -> Stream a -> Bool #

Ord a => Ord (Stream a) 
Instance details

Defined in Data.Text.Internal.Fusion.Types

Methods

compare :: Stream a -> Stream a -> Ordering #

(<) :: Stream a -> Stream a -> Bool #

(<=) :: Stream a -> Stream a -> Bool #

(>) :: Stream a -> Stream a -> Bool #

(>=) :: Stream a -> Stream a -> Bool #

max :: Stream a -> Stream a -> Stream a #

min :: Stream a -> Stream a -> Stream a #

data Step s a #

Intermediate result in a processing pipeline.

Constructors

Done 
Skip !s 
Yield !a !s 

Creation and elimination

stream :: JSString -> Stream Char Source #

O(n) Convert a JSString into a 'Stream Char'.

unstream :: Stream Char -> JSString Source #

O(n) Convert a 'Stream Char' into a JSString.

reverseStream :: JSString -> Stream Char Source #

O(n) Convert a JSString into a 'Stream Char', but iterate backwards.

Transformations

reverse :: Stream Char -> JSString Source #

O(n) Reverse the characters of a string.

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

mapAccumL :: (a -> Char -> (a, Char)) -> a -> Stream Char -> (a, JSString) 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 JSString.

Generation and unfolding

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.

Indexing

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.