Sample from a posterior using Markov chain Monte Carlo

Stackage Nightly 2020-09-28:0.2.3
Latest on Hackage:0.2.3

See all snapshots mcmc appears in

GPL-3.0-or-later licensed by Dominik Schrempf

Module documentation for 0.2.3

This version can be pinned in stack with:mcmc-0.2.3@sha256:87c8604c6cf198d1f52e670a99ab5bb19c4848f9922f142dde378713fefe5d35,2435

Markov chain Monte Carlo

Sample from a posterior using Markov chain Monte Carlo methods.

At the moment, the library is tailored to the Metropolis-Hastings algorithm since it covers most use cases. However, implementation of more algorithms is planned in the future.


The source code contains detailed documentation about general concepts as well as specific functions.


Have a look at the example MCMC analyses. They can be built with Stack and are attached to this repository.

git clone
cd mcmc
stack build

For example, estimate the accuracy of an archer with

stack exec archery


Markov chain Monte Carlo sampling - ChangeLog

Unreleased changes


  • Contrary proposals.
  • Change how monitors are lifted (use normal function, not a lens).
  • Priors.
  • Remove concurrent monitors (was slow).
  • Improve MCMC sampler output.


  • Move away from hpack.


  • Consistently use ByteString instead of Text.
  • Verbosity levels.
  • Improved handling of proposals, moves, and monitors.
  • Bactrian moves.
  • Many small changes.


Many changes; notably it is now possible to continue a Markov chain run.