Copyright | (c) 2019 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Streamly.Internal.Data.Array.Generic
Contents
Description
Synopsis
- data Array a = Array {
- arrContents# :: MutableArray# RealWorld a
- arrStart :: !Int
- arrEnd :: !Int
- unsafeFreeze :: MutArray a -> Array a
- unsafeThaw :: Array a -> MutArray a
- foldr :: (a -> b -> b) -> b -> Array a -> b
- length :: Array a -> Int
- foldl' :: (b -> a -> b) -> b -> Array a -> b
- fromList :: [a] -> Array a
- fromListN :: Int -> [a] -> Array a
- toList :: Array a -> [a]
- read :: forall (m :: Type -> Type) a. Monad m => Array a -> Stream m a
- fold :: Monad m => Fold m a b -> Array a -> m b
- write :: forall (m :: Type -> Type) a. MonadIO m => Fold m a (Array a)
- create :: forall (m :: Type -> Type) a. MonadIO m => Fold m a (Array a)
- strip :: (a -> Bool) -> Array a -> Array a
- chunksOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Stream m a -> Stream m (Array a)
- reader :: forall (m :: Type -> Type) a. Monad m => Unfold m (Array a) a
- unsafeGetIndex :: Int -> Array a -> a
- createOfLast :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a)
- nil :: Array a
- createOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a)
- createWith :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a)
- fromStreamN :: MonadIO m => Int -> Stream m a -> m (Array a)
- fromStream :: MonadIO m => Stream m a -> m (Array a)
- fromPureStream :: Stream Identity a -> Array a
- readRev :: forall (m :: Type -> Type) a. Monad m => Array a -> Stream m a
- getIndex :: Int -> Array a -> Maybe a
- dropAround :: (a -> Bool) -> Array a -> Array a
- unsafeSliceOffLen :: Int -> Int -> Array a -> Array a
- writeN :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a)
- getIndexUnsafe :: Int -> Array a -> a
- getSliceUnsafe :: Int -> Int -> Array a -> Array a
- toParserK :: forall (m :: Type -> Type) a b. Monad m => Parser a m b -> ParserK (Array a) m b
- streamFold :: Monad m => (Stream m a -> m b) -> Array a -> m b
- fromCString# :: MonadIO m => Addr# -> m (Array Word8)
- fromByteStr# :: Addr# -> Array Word8
- parse :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b)
- parsePos :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b)
- parseBreak :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b, StreamK m (Array a))
- parseBreakPos :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b, StreamK m (Array a))
Documentation
Constructors
Array | |
Fields
|
unsafeFreeze :: MutArray a -> Array a Source #
unsafeThaw :: Array a -> MutArray a Source #
write :: forall (m :: Type -> Type) a. MonadIO m => Fold m a (Array a) Source #
Deprecated: Please use create instead.
create :: forall (m :: Type -> Type) a. MonadIO m => Fold m a (Array a) Source #
Fold the whole input to a single array.
Caution! Do not use this on infinite streams.
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.
chunksOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Stream m a -> Stream m (Array a) Source #
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.
writeN :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a) Source #
Deprecated: Please use createOf instead.
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.
toParserK :: forall (m :: Type -> Type) a b. Monad m => Parser a m b -> ParserK (Array a) m b Source #
Convert a Parser
to ParserK
working on generic Array stream.
Pre-release
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 :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b, StreamK m (Array a)) Source #
parseBreakPos :: 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.