circular: Circular fixed-sized mutable vectors

[ bsd3, data-structures, library, math ] [ Propose Tags ]

Please see the README on GitHub at

[Skip to Readme]
Versions [faq] 0.1.0, 0.1.1
Change log
Dependencies aeson, base (>=4.7 && <5), vector [details]
License BSD-3-Clause
Copyright Dominik Schrempf (2020)
Author Dominik Schrempf
Category Math, Data Structures
Home page
Bug tracker
Source repo head: git clone
Uploaded by dschrempf at 2020-06-20T20:14:53Z
Distributions NixOS:0.1.1
Downloads 91 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-06-20 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for circular-0.1.1

[back to package description]


<p align="center"><img src=""/></p>

Circular fixed-sized stacks.

Circular stacks with fxed maximum size are just normal vectors with a pointer to the last element. They are useful because

  • memory usage is constant
  • they are fast, especially when summary statistics need to be computed across the stack (use unsafePush, if possible)
  • they can be saved, and restored using JSON format

When the stack is full, new, pushed elements replace the oldest (deepest) elements on the stack. Complex circular behavior can arise when pushes and pops are mixed. QuickCheck and unit tests with HSpec give promising results — have a look yourself.

I use circular stacks, for example, as the data type for traces of Markov chains.

Circular is actively developed and functions may be removed, renamed, or changed. New ideas are welcome!