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.
Module Lwt: cooperative light-weight threads.
Explicit error handling
Cooperative locks for mutual exclusion
External resource pools.
Mutable sequence of elements (deprecated)
Functional priority queues (deprecated).
The lwt.log package provides a logger engine.
This package depends on the core library
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 logging, spawning processes, ...
Interaction with the garbage collector
Buffered byte channels
Main loop and event queue
Lwt unix main loop engine
Cooperative system calls
This package depends on the core library, the unix package and the lwt.log package.
Reactive programming helpers ¶
The lwt.react package provides helpers for functionnal 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
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 syntax extension for Lwt
The following modules are wrapper for integration of non-Lwt functions/packages into Lwt.
This module allows to mix preemptive threads with Lwt cooperative threads.
Camlp4 syntax extensions ¶
These extensions are deprecated. Use Ppx_lwt instead.
Lwt is shipped with two Camlp4 syntax extensions. The first one, contained in the lwt.syntax package, aims to make coding with Lwt easier, and to make code more readable. The second, contained in the package lwt.syntax.log, is a Camlp4 filter which decreases the performance penalty when using logging by inlining level tests.
Syntactic sugars for Lwt (deprecated)
Special syntax for the logging facility (deprecated)