Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Lwt - API Reference

Core library

The core library (lwt package) contains the Lwt module, which defines cooperative threads with all the primitives to manipulate them. It also provides several general purpose modules, which do not depend on any external package.

Lwt

Asynchronous programming with promises.

Lwt_result

Explicit error handling

Lwt_condition

Conditions

Lwt_list

List helpers

Lwt_mutex

Cooperative locks for mutual exclusion

Lwt_mvar

Mailbox variables

Lwt_pool

External resource pools.

Lwt_stream

Data streams

Lwt_switch

Lwt switches

Lwt_sequence

Mutable sequence of elements (deprecated)

Lwt_pqueue

Functional priority queues (deprecated).

Unix bindings

The lwt.unix package provides:

  • the Lwt_unix module, which wrap system calls into cooperative ones
  • the Lwt_io module, which defines cooperative byte channel, in replacement of ones of the standard library
  • module helpers for spawning processes, ...
Lwt_gc

Interaction with the garbage collector

Lwt_io

Buffered byte channels

Lwt_main

Main loop and event queue

Lwt_engine

Lwt unix main loop engine

Lwt_process

Process management

Lwt_throttle

Rate limiters.

Lwt_timeout

Cancelable timeouts.

Lwt_unix

Cooperative system calls

Lwt_bytes

Byte arrays

Lwt_fmt

Format API for Lwt-powered IOs

Lwt_sys

System informations.

This package depends on the core library and the unix package.

Reactive programming helpers

The lwt.react package provides helpers for functional reactive programming with Lwt. It is based on the react package. The Lwt_react module is a replacement for the React module. It contains:

  • all the functions of the React module
  • Lwt specific primitives
  • cooperative versions of react functions
Lwt_react

React utilities

This package depends on the core library and the react package.

PPX syntax extension

Syntactic sugar for Lwt, such as let%lwt x = e in e' syntax for bind.

Ppx_lwt

Miscellaneous

The following modules are wrapper for integration of non-Lwt functions/packages into Lwt.

Lwt_preemptive

This module allows to mix preemptive threads with Lwt cooperative threads.

Index