Hasty Briefsbeta

Moonpool and OCaml5 in Imandrax

8 days ago
  • #OCaml
  • #Moonpool
  • #Concurrency
  • OCaml 5.0 introduced new concurrency features, leading to libraries like Eio, Miou, and Moonpool.
  • Moonpool, developed by Simon Cruanes, is used in Imandra's proof assistant, imandrax, for parallel task execution.
  • Imandrax is a proprietary proof assistant combining Boyer-Moore techniques and SMT solvers, with around 108 kloc of OCaml.
  • Moonpool allows explicit thread pool management with a Runner.t interface, using OCaml5's effects for direct-style concurrency.
  • Key Moonpool features include thread-safe promises, parallel primitives, and compatibility with picos for cross-library foundations.
  • Imandrax uses Moonpool for CPU-heavy tasks like proof automation, parallel file parsing, and LSP query handling.
  • Moonpool's design avoids monadic contamination, preserves stack traces, and supports structured concurrency patterns.
  • Case study: Parse_import_graph in imandrax uses Moonpool for parallel dependency analysis with shared state via Immlock.t.
  • Future considerations include potential integration with Eio for async I/O, though current focus remains on CPU-bound tasks.