Effects-based direct-style parallel IO stack for OCaml 5, enabling concurrent file, network, and CPU operations with a secure, cross-platform API.
Eio is an effects-based direct-style IO stack for OCaml 5, designed to handle concurrent operations like file I/O, networking, and CPU-intensive tasks. It leverages OCaml 5's effect system to provide a faster, more intuitive alternative to monadic concurrency libraries, with real stack support for better performance and debugging.
OCaml developers building concurrent applications such as network services, interactive tools, or systems requiring parallel I/O and compute, especially those migrating from monadic concurrency libraries like Lwt or Async.
Developers choose Eio for its direct-style programming model that eliminates monadic overhead, provides real stack traces and natural exception handling, and offers structured concurrency with deterministic scheduling for easier testing and debugging.
Effects-based direct-style IO for multicore OCaml
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages OCaml 5's effect system for direct-style code, eliminating monadic overhead and providing real stack traces, as shown in the motivation section where it's faster due to no heap allocations for simulated stacks.
Implements switches for resource management and cancellation, ensuring clean fiber and resource lifecycle, demonstrated in the switches section with Switch.run grouping fibers and releasing resources.
Offers generic APIs with optimized backends for Linux (io_uring), POSIX, Windows, and browsers, allowing high-performance I/O across different environments, as listed in the Eio packages.
Restricts resource access via lexical scoping for enhanced security and auditability, explained in the design note on capabilities where authority is passed explicitly through the env parameter.
Fibers within a domain are scheduled deterministically, aiding testing and debugging, as noted in the design note on determinism, making mock-based tests predictable.
The Windows backend (Eio_windows) is explicitly marked as incomplete with 'help wanted' in the README, limiting its usability for cross-platform projects targeting Windows.
While integrations exist for Lwt, Async, and others, the broader third-party library support is still nascent compared to established concurrency libraries, requiring more effort for adoption in complex projects.
Error reporting uses nested Eio.Io exceptions with backend-specific details, which can be verbose and require careful matching for portable code, as shown in the error handling section where Unix-specific errors need filtering.
Using multiple domains introduces non-determinism and requires extra care for thread-safety, as highlighted in the multicore support section and the separate multicore guide, adding overhead for parallel programming.
Eio is an open-source alternative to the following products: