package algaeff

  1. Overview
  2. Docs
Reusable Effects-Based Components

Install

Dune Dependency

Authors

Maintainers

Sources

0.2.0.tar.gz
md5=433b1583d4ffd0d2cb5310f1918935e4
sha512=9e003e4916d579d063e5ae72302c71ca640e0b568378db25c6dc90becbcd6508f23dc29211a2849f745c54871f6611be0a37ea8526a08ecc203147838975ae70

Description

This OCaml library collects reusable effects-based components we have identified while developing our proof assistants based on algebraic effects.

Published: 03 Jun 2022

README

README.markdown

# 🦠 Reusable Effects-Based Components

OCaml is bringing algebraic effects to the mainstream, and this library aims to collect reusable effects-based components we have identified.

## Stability

⚠ The API is experimental and unstable. We will break things!

## Components

- [Algaeff.State](https://redprl.org/algaeff/algaeff/Algaeff/State): mutable states
- [Algaeff.Reader](https://redprl.org/algaeff/algaeff/Algaeff/Reader): read-only environments
- [Algaeff.Sequencer](https://redprl.org/algaeff/algaeff/Algaeff/Sequencer): making a `Seq.t`
- [Algaeff.Mutex](https://redprl.org/algaeff/algaeff/Algaeff/Mutex): simple locking to prevent re-entrance
- [Algaeff.UniqueID](https://redprl.org/algaeff/algaeff/Algaeff/UniqueID): generating unique IDs
- [Algaeff.Unmonad](https://redprl.org/algaeff/algaeff/Algaeff/Unmonad): effects for any monadic operations

Effect-based concurrency (cooperative lightweight threading) was already tackled by other libraries
such as [Eio](https://github.com/ocaml-multicore/eio) and [Affect](https://erratique.ch/software/affect).
This library focuses on the rest.

There are a few other useful functions:

- [Algaeff.Fun.Deep.finally](https://redprl.org/algaeff/algaeff/Algaeff/Fun/Deep/index.html#val-finally): call `continue` or `discontinue` accordingly.
- [Algaeff.Fun.Shallow.finally\_with](https://redprl.org/algaeff/algaeff/Algaeff/Fun/Shallow/index.html#val-finally_with): same as above, but for shallow effect handlers.

## How to Use It

### OCaml >= 5.0.0

You need OCaml 5.

### Example Code

```ocaml
module S = Algaeff.State.Make (struct type state = int end)

let forty_two = S.run ~init:100 @@ fun () ->
  print_int (S.get ()); (* this will print out 100 *)
  S.set 42;
  S.get ()
```

### Documentation

[Here is the API documentation.](https://redprl.org/algaeff/algaeff/Algaeff)

Dependencies (2)

  1. ocaml >= "5.0"
  2. dune >= "2.0"

Dev Dependencies (3)

  1. odoc with-doc
  2. qcheck-core >= "0.18" & with-test
  3. alcotest >= "1.5" & with-test

Used by (2)

  1. forester >= "2.1" & < "2.4"
  2. yuujinchou >= "3.0.0" & < "5.2.0"

Conflicts

None