Online statistics


Keywords
bsd3, library, Propose Tags, , Index, Quick Jump, Data.Mealy, Data.Mealy.Quantiles, Data.Mealy.Simulate, mealy-0.4.4.1.tar.gz, browse, Package description, Package maintainers, tonyday567, edit package information
License
BSD-3-Clause
Install
cabal install mealy-0.4.4.1

Documentation

mealy

https://img.shields.io/hackage/v/mealy.svg https://github.com/tonyday567/mealy/workflows/haskell-ci/badge.svg

A ‘Mealy’ is a triple of functions

  • (a -> b) inject: Convert (initial) input into the (initial) state type.
  • (b -> a -> b) step: Update state given prior state and (new) input.
  • (c -> b) extract: Convert state to the output type.

A sum, for example, looks like M id (+) id where the first id is the initial injection and the second id is the covariant extraction.

This library provides support for computing statistics (such as an average or a standard deviation) as current state within a mealy context.

Usage

Usage is to supply a decay function representing the relative weights of recent values versus older ones, in the manner of exponentially-weighted averages. The library attempts to be polymorphic in the statistic which can be combined in applicative style.

import Prelude
import Data.Mealy
fold ((,) <$> ma 0.9 <*> std 0.9) [1..100::Double]

Reference

Finite State Transducers