Affect 242710b

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:

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

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.

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.