package affect

  1. Overview
  2. Docs
Streamlined and natural concurrency model for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

affect-0.0.0.tbz
sha512=b328f6696e60c489da8cc2e8fad0537ca6634a39fc0c5de5840d4f98561f110617ef79ba8285ee8427dd99908c6b3d39114973598cddc5ded91abcce3b91b9a6

doc/index.html

Affect v0.0.0

Affect is a streamlined and natural concurrency model for OCaml.

It provides parallel asynchronous functions and first-class synchronous actions to orchestrate them. The resulting concurency model has structured cooperative concurrency, structured cancellation and structured effect handling.

Warning. These APIs are still subject to change in the future, especially the private ones. Feedback and suggestions are welcome on the project's issue tracker.

Manuals

The following manuals are available:

  • The quick start should do so.
  • The short concurrency model is recommended reading to form your mental model.
  • The basics of actions should be read if you have advanced synchronization needs.
  • The cookbook has a few conventions, recipes and answers to common questions.
  • The design notes explains a few design choices made by the library.

Library affect

Asynchronous functions

Asynchronous functions are made available in an extended Stdlib.Fun module.

Actions

The Action module provides first-class synchronization (can be used independently). A few derived synchronization structures are provided.

Library affect.unix

Library affect.cli

  • Affect_cli

Library affect.tmp

This library has unstable functionality that will be moved to another library in the future. It may still be useful if you are playing with affect.

  • Net Networking.

Quick start

open Affect

let main () =
  Fun.Async.main @@ fun () ->
  let f0 = Fun.Async.call (fun () -> 1) in
  let f1 = Fun.Async.call (fun () -> 2) in
  print_int (Fun.Async.get f0 + Fun.Async.get f1);
  0

let () = if !Sys.interactive then () else exit (main ())

See other blueprints in the cookbook.