histogram-fill-0.1.0: Library for histograms creation.

MaintainerAlexey Khudyakov <alexey.skladnoy@gmail.com>




Mutable histograms.


Mutable histograms

data HistogramST s bin a whereSource

Mutable histogram.


HistogramST :: (Bin bin, UA a) => bin -> MUArr a s -> MUArr a s -> HistogramST s bin a 

newHistogramST :: (Bin bin, UA a) => a -> bin -> ST s (HistogramST s bin a)Source

Create new mutable histogram. All bins are set to zero element as passed to function.

fillOne :: Num a => HistogramST s bin a -> BinValue bin -> ST s ()Source

Put one value into histogram

fillOneW :: Num a => HistogramST s bin a -> (BinValue bin, a) -> ST s ()Source

Put one value into histogram with weight

fillMonoid :: Monoid a => HistogramST s bin a -> (BinValue bin, a) -> ST s ()Source

Put one monoidal element

freezeHist :: HistogramST s bin a -> ST s (Histogram bin a)Source

Create immutable histogram from mutable one. This operation involve copying.


class Accumulator h whereSource

This is class with accumulation semantics. It's used to fill many histogram at once. It accept values of type a and return data of type b.


putOne :: h s a b -> a -> ST s ()Source

Put one element into accumulator

extract :: Monoid b => h s a b -> ST s bSource

Extract data from historam


Accumulator AccumHist 
Accumulator AccumList 
Accumulator Accum 

data Accum s a b whereSource

Abstract wrapper for histograms.


Accum :: Accumulator h => h s a b -> Accum s a b 


accumList :: [ST s (Accum s a b)] -> ST s (Accum s a b)Source

Wrap list of histograms into one Accum

accumHist :: Bin bin => (a -> HistogramST s bin val -> ST s ()) -> (Histogram bin val -> b) -> HistogramST s bin val -> ST s (Accum s a b)Source

Accumulator for arbitrary HistogramST based histogram

fillHistograms :: Monoid b => (forall s. ST s (Accum s a b)) -> [a] -> bSource

Put all values into histogram and return result