Getting started
Minimal examples · How LazyPPL works
Choose a route
In your browser
LazyPPL is a Haskell library for Bayesian probabilistic programming.
In Codespaces
Codespaces needs a GitHub account and opens the project in VS Code with GHC and Cabal already installed.
Install locally on Ubuntu 24.04
System libraries
On Ubuntu, you can install the system libraries and the build tools as an administrator with
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential ca-certificates curl git xz-utils libgmp-dev libtinfo-dev libffi-devGHCup and Cabal
The system uses Haskell Cabal. You need to install GHCup first, then GHC and Cabal, in your regular user account.
curl --proto "=https" --tlsv1.2 -sSf https://get-ghcup.haskell.org | env BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=0 sh
source "$HOME/.ghcup/env"
ghcup install ghc 9.14.1
ghcup set ghc 9.14.1
ghcup install cabal 3.18.2.0
ghcup set cabal 3.18.2.0Get LazyPPL
git clone https://github.com/lazyppl-team/lazyppl.git lazypplOpen a terminal in the cloned lazyppl directory. Select the source revision used by these examples:
source "$HOME/.ghcup/env"
git switch --detach 859ee06149d0866068fd9e20e02e7f9efa7a4ccc
cabal updateCabal uses GHC 9.14.1 installed above.
Run the first example
To explore with GHCi, type
cabal repl lib:lazyppl-examplesThis takes some time (about two minutes on two vCPUs) if it is your first time ever using Cabal. To explore with GHCi again, type the same command (a later load took about one second).
To run, type the following at the GHCi prompt
:module + MinimalDemo
runPoissonSimThis printed the following in one run (the example draws 10,000 samples, so other runs give slightly different numbers).
k poisson(k)
-- ----------
0 0.3678
1 0.3685
2 0.1804
3 6.48e-2
4 1.4e-2
5 3.6e-3
6 8.0e-4
7 1.0e-4To leave GHCi, type
:quitBuild the package
To build, type
cabal buildOther operating systems
For other operating systems, see the GHCup and Cabal installation guides.