streamly-0.7.3: Beautiful Streaming, Concurrent and Reactive Composition
Copyright(c) 2019 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Streamly.Internal.Data.SmallArray

Description

 
Synopsis

Documentation

data SmallArray a Source #

Constructors

SmallArray (SmallArray# a) 

Instances

Instances details
Monad SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Methods

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

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

return :: a -> SmallArray a #

Functor SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Methods

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

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

MonadFix SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Methods

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

MonadFail SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Methods

fail :: String -> SmallArray a #

Applicative SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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 #

Foldable SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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 #

Traversable SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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) #

Eq1 SmallArray Source #

Since: 0.6.4.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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.Types

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.Types

Show1 SmallArray Source #

Since: 0.6.4.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Methods

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

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

MonadZip SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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) #

Alternative SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

MonadPlus SmallArray Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

IsList (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Associated Types

type Item (SmallArray a) #

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

Defined in Streamly.Internal.Data.SmallArray.Types

Methods

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

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

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

Defined in Streamly.Internal.Data.SmallArray.Types

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) #

Ord a => Ord (SmallArray a) Source #

Lexicographic ordering. Subject to change between major versions.

Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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

Defined in Streamly.Internal.Data.SmallArray.Types

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

Defined in Streamly.Internal.Data.SmallArray.Types

Semigroup (SmallArray a) Source #

Since: 0.6.3.0

Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

Monoid (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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

Defined in Streamly.Internal.Data.SmallArray

Methods

rnf :: SmallArray a -> () #

type Item (SmallArray a) Source # 
Instance details

Defined in Streamly.Internal.Data.SmallArray.Types

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.Memory.Array.

toStream :: (Monad m, IsStream t) => SmallArray a -> t m a Source #

toStreamRev :: (Monad m, IsStream t) => SmallArray a -> t m a Source #

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.Memory.Array

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 -> () #