package algaeff

  1. Overview
  2. Docs
Reusable Effects-Based Components

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.0.tar.gz
md5=070071daf587ff50ba0f60266ab7c5d9
sha512=257762cb07c75d22f1ae3a0da3a37b2aa2ab8bca7a7dc036b940163fc238b64a7d92efa2535c3bb8185a1f39cc3841cdce5ad936fd2dd804eff25dd68dd21d39

Description

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

Published: 18 May 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.Mutex](https://redprl.org/algaeff/algaeff/Algaeff/Mutex): simple locking to prevent re-entrance
- [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 and modules:

- [Algaeff.StdlibShim](https://redprl.org/algaeff/algaeff/Algaeff/StdlibShim): a shim for OCaml < 5.
- [Algaeff.Fun.Deep.finally](https://redprl.org/algaeff/algaeff/Algaeff/Fun/Deep/index.html#val-finally): call `continue` or `discontinue` accordingly.
- [Algaeff.Fun.Deep.reperform](https://redprl.org/algaeff/algaeff/Algaeff/Fun/Deep/index.html#val-reperform): continue performing an effect.

## How to Use It

### OCaml >= 5.0.0, OCaml 4.12+domains, or OCaml 4.12+domains+effects

You need a version of OCaml that supports algebraic effects.

### 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. base-domains
  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 (1)

  1. forester >= "2.1" & < "2.4"

Conflicts

None

OCaml

Innovation. Community. Security.