Copyright | (c) 2019 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data Array a = Array {
- arrContents# :: MutableArray# RealWorld a
- arrStart :: !Int
- arrLen :: !Int
- nil :: Array a
- createOf :: MonadIO m => Int -> Fold m a (Array a)
- create :: MonadIO m => Fold m a (Array a)
- writeWith :: MonadIO m => Int -> Fold m a (Array a)
- writeLastN :: 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
- fromByteStr# :: Addr# -> Array Word8
- fromListN :: Int -> [a] -> Array a
- fromList :: [a] -> Array a
- chunksOf :: forall m a. MonadIO m => Int -> Stream m a -> Stream m (Array a)
- length :: Array a -> Int
- reader :: Monad m => Unfold m (Array a) a
- toList :: Array a -> [a]
- read :: Monad m => Array a -> Stream m a
- readRev :: Monad m => Array a -> Stream m a
- foldl' :: (b -> a -> b) -> b -> Array a -> b
- foldr :: (a -> b -> b) -> b -> Array a -> b
- streamFold :: Monad m => (Stream m a -> m b) -> Array a -> m b
- fold :: Monad m => Fold m a b -> Array a -> m b
- getIndexUnsafe :: Int -> Array a -> a
- getIndex :: Int -> Array a -> Maybe a
- getSliceUnsafe :: Int -> Int -> Array a -> Array a
- strip :: (a -> Bool) -> Array a -> Array a
- writeN :: MonadIO m => Int -> Fold m a (Array a)
- write :: MonadIO m => Fold m a (Array a)
Documentation
Array | |
|
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
getIndexUnsafe :: 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.
strip :: (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.