Streamly.Internal.Data.Array.Generic
Documentation
Constructors
| Array | |
Fields
| |
Conversion
unsafeFreeze :: MutArray a -> Array a Source #
unsafeThaw :: Array a -> MutArray a Source #
Construction
create :: MonadIO m => Fold m a (Array a) Source #
Fold the whole input to a single array.
Caution! Do not use this on infinite streams.
Elimination
Random Access
unsafeGetIndex :: Int -> Array a -> a Source #
O(1) Lookup the element at the given index. Index starts from 0. Does not check the bounds.
Since: 0.8.0
getIndex :: Int -> Array a -> Maybe a Source #
Lookup the element at the given index. Index starts from 0.
dropAround :: (a -> Bool) -> Array a -> Array a Source #
Truncate the array at the beginning and end as long as the predicate holds true. Returns a slice of the original array.
Parsing Stream of Arrays
toParserK :: Monad m => Parser a m b -> ParserK (Array a) m b Source #
Convert a Parser to ParserK working on generic Array stream.
Pre-release
Deprecated
strip :: (a -> Bool) -> Array a -> Array a Source #
Deprecated: Please use dropAround instead.
Truncate the array at the beginning and end as long as the predicate holds true. Returns a slice of the original array.
getIndexUnsafe :: Int -> Array a -> a Source #
Deprecated: Please use unsafeGetIndex instead.
O(1) Lookup the element at the given index. Index starts from 0. Does not check the bounds.
Since: 0.8.0
getSliceUnsafe :: Int -> Int -> Array a -> Array a Source #
Deprecated: Please use unsafeSliceOffLen instead.
fromByteStr# :: Addr# -> Array Word8 Source #
Deprecated: Please use 'unsafePerformIO . fromCString#' instead
Parsing Stream of Arrays
parse :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b) Source #
parsePos :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b) Source #
parseBreak :: forall m a b. Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b, StreamK m (Array a)) Source #
parseBreakPos :: forall m a b. Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b, StreamK m (Array a)) Source #
Like parseBreak but includes stream position information in the error
messages.