Copyright | (c) 2019 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Streamly.Data.Array.Generic
Description
Unconstrained version of Streamly.Data.Array module.
See the Streamly.Data.Array module for documentation.
Synopsis
- data Array a
- fromListN :: Int -> [a] -> Array a
- fromList :: [a] -> Array a
- createOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a)
- create :: forall (m :: Type -> Type) a. MonadIO m => Fold m a (Array a)
- toList :: Array a -> [a]
- read :: forall (m :: Type -> Type) a. Monad m => Array a -> Stream m a
- readRev :: forall (m :: Type -> Type) a. Monad m => Array a -> Stream m a
- reader :: forall (m :: Type -> Type) a. Monad m => Unfold m (Array a) a
- chunksOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Stream m a -> Stream m (Array a)
- toParserK :: forall (m :: Type -> Type) a b. Monad m => Parser a m b -> ParserK (Array a) m b
- parse :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b)
- parseBreak :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b, StreamK m (Array a))
- parsePos :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b)
- parseBreakPos :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b, StreamK m (Array a))
- length :: Array a -> Int
- getIndex :: Int -> Array a -> Maybe a
- writeN :: forall (m :: Type -> Type) a. MonadIO m => Int -> Fold m a (Array a)
- write :: forall (m :: Type -> Type) a. MonadIO m => Fold m a (Array a)
Documentation
Construction
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.
Conversion
Streams
Unfolds
Stream of Arrays
chunksOf :: forall (m :: Type -> Type) a. MonadIO m => Int -> Stream m a -> Stream m (Array a) Source #
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
parse :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b) Source #
parseBreak :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseError b, StreamK m (Array a)) Source #
parsePos :: Monad m => ParserK (Array a) m b -> StreamK m (Array a) -> m (Either ParseErrorPos b) 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.
Random Access
getIndex :: Int -> Array a -> Maybe a Source #
Lookup the element at the given index. Index starts from 0.