javelin-0.1.1.0: Labeled one-dimensional arrays
Copyright(c) Laurent P. René de Cotret
LicenseMIT
Maintainerlaurent.decotret@outlook.com
Portabilityportable
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Series.Generic.Internal

Description

WARNING

This module is considered internal. Using the Series constructor directly may result in loss or corruption of data if not handled carefully.

The Package Versioning Policy still applies.

Synopsis

Constructor

data Series v k a Source #

A Series v k a is a labeled array of type v filled with values of type a, indexed by keys of type k.

Like Map, they support efficient:

  • random access by key ( \(O(\log n)\) );
  • slice by key ( \(O(\log n)\) ).

Like Vector, they support efficient:

  • random access by index ( \(O(1)\) );
  • slice by index ( \(O(1)\) );
  • numerical operations.

Constructors

MkSeries 

Fields

  • index :: Index k

    The Index of a series, which contains its (unique) keys in ascending order.

  • values :: v a

    The values of a series, in the order of its (unique) keys.

Instances

Instances details
(forall a. Vector v a, Vector v k, Foldable v, Functor v) => FoldableWithIndex k (Series v k) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> Series v k a -> m #

ifoldMap' :: Monoid m => (k -> a -> m) -> Series v k a -> m #

ifoldr :: (k -> a -> b -> b) -> b -> Series v k a -> b #

ifoldl :: (k -> b -> a -> b) -> b -> Series v k a -> b #

ifoldr' :: (k -> a -> b -> b) -> b -> Series v k a -> b #

ifoldl' :: (k -> b -> a -> b) -> b -> Series v k a -> b #

(forall a. Vector v a, Functor v) => FunctorWithIndex k (Series v k) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

imap :: (k -> a -> b) -> Series v k a -> Series v k b #

(forall a. Vector v a, Functor v, Foldable v, Ord k, Traversable v) => TraversableWithIndex k (Series v k) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

itraverse :: Applicative f => (k -> a -> f b) -> Series v k a -> f (Series v k b) #

Foldable v => Bifoldable (Series v) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

bifold :: Monoid m => Series v m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Series v a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Series v a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Series v a b -> c #

Foldable v => Foldable (Series v k) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

fold :: Monoid m => Series v k m -> m #

foldMap :: Monoid m => (a -> m) -> Series v k a -> m #

foldMap' :: Monoid m => (a -> m) -> Series v k a -> m #

foldr :: (a -> b -> b) -> b -> Series v k a -> b #

foldr' :: (a -> b -> b) -> b -> Series v k a -> b #

foldl :: (b -> a -> b) -> b -> Series v k a -> b #

foldl' :: (b -> a -> b) -> b -> Series v k a -> b #

foldr1 :: (a -> a -> a) -> Series v k a -> a #

foldl1 :: (a -> a -> a) -> Series v k a -> a #

toList :: Series v k a -> [a] #

null :: Series v k a -> Bool #

length :: Series v k a -> Int #

elem :: Eq a => a -> Series v k a -> Bool #

maximum :: Ord a => Series v k a -> a #

minimum :: Ord a => Series v k a -> a #

sum :: Num a => Series v k a -> a #

product :: Num a => Series v k a -> a #

Traversable v => Traversable (Series v k) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

traverse :: Applicative f => (a -> f b) -> Series v k a -> f (Series v k b) #

sequenceA :: Applicative f => Series v k (f a) -> f (Series v k a) #

mapM :: Monad m => (a -> m b) -> Series v k a -> m (Series v k b) #

sequence :: Monad m => Series v k (m a) -> m (Series v k a) #

Functor v => Functor (Series v k) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

fmap :: (a -> b) -> Series v k a -> Series v k b #

(<$) :: a -> Series v k b -> Series v k a #

(Vector v a, Ord k) => Monoid (Series v k a) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

mempty :: Series v k a #

mappend :: Series v k a -> Series v k a -> Series v k a #

mconcat :: [Series v k a] -> Series v k a #

(Vector v a, Ord k) => Semigroup (Series v k a) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

(<>) :: Series v k a -> Series v k a -> Series v k a #

sconcat :: NonEmpty (Series v k a) -> Series v k a #

stimes :: Integral b => b -> Series v k a -> Series v k a #

(Vector v a, Ord k, Show k, Show a) => Show (Series v k a) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

showsPrec :: Int -> Series v k a -> ShowS #

show :: Series v k a -> String #

showList :: [Series v k a] -> ShowS #

(NFData (v a), NFData k2) => NFData (Series v k2 a) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

rnf :: Series v k2 a -> () #

(Vector v a, Eq k, Eq a) => Eq (Series v k a) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

(==) :: Series v k a -> Series v k a -> Bool #

(/=) :: Series v k a -> Series v k a -> Bool #

(Vector v a, Ord (v a), Ord k, Ord a) => Ord (Series v k a) Source # 
Instance details

Defined in Data.Series.Generic.Definition

Methods

compare :: Series v k a -> Series v k a -> Ordering #

(<) :: Series v k a -> Series v k a -> Bool #

(<=) :: Series v k a -> Series v k a -> Bool #

(>) :: Series v k a -> Series v k a -> Bool #

(>=) :: Series v k a -> Series v k a -> Bool #

max :: Series v k a -> Series v k a -> Series v k a #

min :: Series v k a -> Series v k a -> Series v k a #

Unsafe construction

fromDistinctAscList :: Vector v a => [(k, a)] -> Series v k a Source #

\(O(n)\) Build a Series from a list of pairs, where the first elements of the pairs (the keys) are distinct elements in ascending order. The precondition that the keys be unique and sorted is not checked.

fromDistinctAscVector :: (Vector v k, Vector v a, Vector v (k, a)) => v (k, a) -> Series v k a Source #

\(O(n)\) Build a Series from a vector of pairs, where the first elements of the pairs (the keys) are distinct elements in ascending order. The precondition that the keys be unique and sorted is not checked.

Unsafe selection

selectSubset :: (Vector v a, Ord k) => Series v k a -> Index k -> Series v k a Source #

Implementation of select where the selection keys are known to be a subset of the series. This precondition is NOT checked.

This is a performance optimization and therefore is not normally exposed.