streamly-0.8.3: Dataflow programming and declarative concurrency
Copyright(c) 2019 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.SmallArray

Description

 
Synopsis

Documentation

data SmallArray a Source #

Constructors

SmallArray (SmallArray# a) 

Instances

Instances details
MonadFail SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

fail :: String -> SmallArray a #

MonadFix SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

mfix :: (a -> SmallArray a) -> SmallArray a #

MonadZip SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

mzip :: SmallArray a -> SmallArray b -> SmallArray (a, b) #

mzipWith :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c #

munzip :: SmallArray (a, b) -> (SmallArray a, SmallArray b) #

Foldable SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

fold :: Monoid m => SmallArray m -> m #

foldMap :: Monoid m => (a -> m) -> SmallArray a -> m #

foldMap' :: Monoid m => (a -> m) -> SmallArray a -> m #

foldr :: (a -> b -> b) -> b -> SmallArray a -> b #

foldr' :: (a -> b -> b) -> b -> SmallArray a -> b #

foldl :: (b -> a -> b) -> b -> SmallArray a -> b #

foldl' :: (b -> a -> b) -> b -> SmallArray a -> b #

foldr1 :: (a -> a -> a) -> SmallArray a -> a #

foldl1 :: (a -> a -> a) -> SmallArray a -> a #

toList :: SmallArray a -> [a] #

null :: SmallArray a -> Bool #

length :: SmallArray a -> Int #

elem :: Eq a => a -> SmallArray a -> Bool #

maximum :: Ord a => SmallArray a -> a #

minimum :: Ord a => SmallArray a -> a #

sum :: Num a => SmallArray a -> a #

product :: Num a => SmallArray a -> a #

Eq1 SmallArray Source #

Since: 0.6.4.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

liftEq :: (a -> b -> Bool) -> SmallArray a -> SmallArray b -> Bool #

Ord1 SmallArray Source #

Since: 0.6.4.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

liftCompare :: (a -> b -> Ordering) -> SmallArray a -> SmallArray b -> Ordering #

Read1 SmallArray Source #

Since: 0.6.4.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Show1 SmallArray Source #

Since: 0.6.4.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> SmallArray a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [SmallArray a] -> ShowS #

Traversable SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

traverse :: Applicative f => (a -> f b) -> SmallArray a -> f (SmallArray b) #

sequenceA :: Applicative f => SmallArray (f a) -> f (SmallArray a) #

mapM :: Monad m => (a -> m b) -> SmallArray a -> m (SmallArray b) #

sequence :: Monad m => SmallArray (m a) -> m (SmallArray a) #

Alternative SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Applicative SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

pure :: a -> SmallArray a #

(<*>) :: SmallArray (a -> b) -> SmallArray a -> SmallArray b #

liftA2 :: (a -> b -> c) -> SmallArray a -> SmallArray b -> SmallArray c #

(*>) :: SmallArray a -> SmallArray b -> SmallArray b #

(<*) :: SmallArray a -> SmallArray b -> SmallArray a #

Functor SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

fmap :: (a -> b) -> SmallArray a -> SmallArray b #

(<$) :: a -> SmallArray b -> SmallArray a #

Monad SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

(>>=) :: SmallArray a -> (a -> SmallArray b) -> SmallArray b #

(>>) :: SmallArray a -> SmallArray b -> SmallArray b #

return :: a -> SmallArray a #

MonadPlus SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Data a => Data (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SmallArray a -> c (SmallArray a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (SmallArray a) #

toConstr :: SmallArray a -> Constr #

dataTypeOf :: SmallArray a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (SmallArray a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (SmallArray a)) #

gmapT :: (forall b. Data b => b -> b) -> SmallArray a -> SmallArray a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SmallArray a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SmallArray a -> r #

gmapQ :: (forall d. Data d => d -> u) -> SmallArray a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SmallArray a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SmallArray a -> m (SmallArray a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SmallArray a -> m (SmallArray a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SmallArray a -> m (SmallArray a) #

Monoid (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Semigroup (SmallArray a) Source #

Since: 0.6.3.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

IsList (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

Associated Types

type Item (SmallArray a) #

Read a => Read (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

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

Defined in Streamly.Internal.Data.SmallArray.Type

NFData a => NFData (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray

Methods

rnf :: SmallArray a -> () #

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

Defined in Streamly.Internal.Data.SmallArray.Type

Methods

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

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

Ord a => Ord (SmallArray a) Source #

Lexicographic ordering. Subject to change between major versions.

Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

type Item (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Type

type Item (SmallArray a) = a

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

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

writeN :: MonadIO m => Int -> Fold m a (SmallArray a) Source #

writeN n folds a maximum of n elements from the input stream to an SmallArray.

Since we are folding to a SmallArray n should be <= 128, for larger number of elements use an Array from either Streamly.Data.Array or Streamly.Data.Array.Foreign.

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

Create a SmallArray from the first n elements of a list. The array may hold less than n elements if the length of the list <= n.

It is recommended to use a value of n <= 128. For larger sized arrays, use an Array from Streamly.Data.Array or Streamly.Data.Array.Foreign

fromStreamDN :: MonadIO m => Int -> Stream m a -> m (SmallArray a) Source #

fromStreamN :: MonadIO m => Int -> SerialT m a -> m (SmallArray a) Source #

Create a SmallArray from the first n elements of a stream. The array is allocated to size n, if the stream terminates before n elements then the array may hold less than n elements.

For optimal performance use this with n <= 128.

streamFold :: Monad m => (SerialT m a -> m b) -> SmallArray a -> m b Source #

fold :: Monad m => Fold m a b -> SmallArray a -> m b Source #

Orphan instances

NFData a => NFData (SmallArray a) Source # 
Instance details

Methods

rnf :: SmallArray a -> () #