streamly-core
Copyright(c) 2019 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Streamly.Internal.Data.Array.Generic

Description

 
Synopsis

Documentation

data Array a Source #

Constructors

Array 

Fields

Instances

Instances details
Read a => Read (Array a) Source # 
Instance details

Defined in Streamly.Internal.Data.Array.Generic.Type

Show a => Show (Array a) Source # 
Instance details

Defined in Streamly.Internal.Data.Array.Generic.Type

Methods

showsPrec :: Int -> Array a -> ShowS #

show :: Array a -> String #

showList :: [Array a] -> ShowS #

Eq a => Eq (Array a) Source # 
Instance details

Defined in Streamly.Internal.Data.Array.Generic.Type

Methods

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

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

Ord a => Ord (Array a) Source # 
Instance details

Defined in Streamly.Internal.Data.Array.Generic.Type

Methods

compare :: Array a -> Array a -> Ordering #

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

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

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

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

max :: Array a -> Array a -> Array a #

min :: Array a -> Array a -> Array a #

foldr :: (a -> b -> b) -> b -> Array a -> b Source #

foldl' :: (b -> a -> b) -> b -> Array a -> b Source #

fromList :: [a] -> Array a Source #

fromListN :: Int -> [a] -> Array a Source #

toList :: Array a -> [a] Source #

read :: forall (m :: Type -> Type) a. Monad m => Array a -> Stream m a Source #

fold :: Monad m => Fold m a b -> Array a -> m b 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 #

reader :: forall (m :: Type -> Type) a. Monad m => Unfold m (Array a) 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

createOfLast :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a) Source #

createOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a) Source #

createWith :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a) Source #

fromStreamN :: MonadIO m => Int -> Stream m a -> m (Array a) Source #

fromStream :: MonadIO m => Stream m a -> m (Array a) Source #

readRev :: forall (m :: Type -> Type) a. Monad m => Array a -> Stream m a Source #

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

streamFold :: Monad m => (Stream m a -> m b) -> Array a -> m b Source #

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.