mealy: Mealy machines for processing time-series and ordered data.

[ algorithm, bsd3, library ] [ Propose Tags ] [ Report a vulnerability ]

mealy reimagines statistics as a mealy machine processing data with some form of order such as time-series data. The Mealy, with the help of a decay function specifying the relative weights of recent values versus older value, can be treated as a compression or summary of the data stream into 'current state.' Mealies are highly polymorphic, situated at a busy crossroad of theory and practice, and lend themselves to ergonmic, compact and realistic representations of a wide range of online phenomena.

Usage

>>> import Mealy
>>> fold ((,) <$> ma 0.9 <*> std 0.9) [1..100]
(91.00265621044142,9.472822805289121)

[Skip to Readme]

Modules

[Last Documentation]

  • Data
    • Data.Mealy
      • Data.Mealy.Quantiles
      • Data.Mealy.Simulate

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.4.1, 0.4.5.0, 0.5.0.0, 0.5.0.1, 0.5.1.0, 0.5.1.1
Change log ChangeLog.md
Dependencies adjunctions (>=4.0 && <4.5), base (>=4.14 && <5), containers (>=0.6 && <0.9), harpie (>=0.1 && <0.2), harpie-numhask (>=0.1 && <0.2), mealy, mwc-probability (>=2.3.1 && <2.4), numhask (>=0.11 && <0.14), optparse-applicative (>=0.17 && <0.20), perf (>=0.14 && <0.15), primitive (>=0.7.2 && <0.10), profunctors (>=5.6.2 && <5.7), tdigest (>=0.2.1 && <0.4), text (>=1.2 && <2.2), vector (>=0.12.3 && <0.14), vector-algorithms (>=0.8.0 && <0.10) [details]
Tested with ghc ==9.10.3, ghc ==9.12.2, ghc ==9.14.1
License BSD-3-Clause
Copyright Tony Day (c) 2013
Author Tony Day
Maintainer tonyday567@gmail.com
Uploaded by tonyday567 at 2026-01-10T13:09:27Z
Category algorithm
Home page https://github.com/tonyday567/mealy#readme
Bug tracker https://github.com/tonyday567/mealy/issues
Source repo head: git clone https://github.com/tonyday567/mealy
Distributions LTSHaskell:0.5.0.1, NixOS:0.5.0.1
Reverse Dependencies 3 direct, 2 indirect [details]
Executables mealy-perf
Downloads 1401 total (47 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2026-01-10 [all 2 reports]

Readme for mealy-0.5.1.0

[back to package description]

mealy

Hackage Build Status

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]
(91.00265621044142,9.472822805289121)

Reference

Finite State Transducers