analyze-0.1.0.0: making data science easy and safe with data frames

Safe HaskellNone
LanguageHaskell2010

Analyze.Common

Description

Common internal things (no other internal deps)

Synopsis

Documentation

type Data k = (Eq k, Hashable k, Show k, Typeable k) Source #

Column keys need to have equality and hashability.

(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 Source #

flip $

checkForDupes :: (Data k, MonadThrow m) => Vector k -> m () Source #

Throws when duplicate keys are present in a vector.

checkReorder :: (Data k, MonadThrow m) => Vector k -> Vector k -> m () Source #

Throws when one vector is not a reordering of the other.

checkSubset :: (Data k, MonadThrow m) => [k] -> HashSet k -> m () Source #

Throws when any key is not present in the set.

makeLookup :: Data k => Vector k -> HashMap k Int Source #

Builds a reverse lookup for the vector.

runLookup :: (Data k, MonadThrow m) => HashMap k Int -> Vector v -> k -> m v Source #

Indexes into the vector of values, throwing on key missing or bad index.

reorder :: Data k => Vector k -> HashMap k Int -> Vector v -> Vector v Source #

Reorders the vector of values by a new key order and an old lookup.

mergeKeys :: Data k => Vector k -> Vector k -> Vector (k, Int, Int) Source #

Merges two key vectors and tags each with its provenance (favoring the second).

runIndexedLookup :: Vector (k, Int, Int) -> Vector v -> Vector v -> Vector v Source #

Uses a merged key vector to select values.