histogram-fill-0.1.0: Library for histograms creation.

Stabilityexperimental
MaintainerAlexey Khudyakov <alexey.skladnoy@gmail.com>

Data.Histogram.ST

Contents

Description

Mutable histograms.

Synopsis

Mutable histograms

data HistogramST s bin a whereSource

Mutable histogram.

Constructors

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.

Accumulators

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.

Methods

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

Instances

Accumulator AccumHist 
Accumulator AccumList 
Accumulator Accum 

data Accum s a b whereSource

Abstract wrapper for histograms.

Constructors

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

Instances

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