OCaml Papers

Tail Modulo Cons, OCaml, and Relational Separation Logic

Common functional languages incentivize tail-recursive functions, as opposed to general recursive functions that consume stack space and may not scale to large inputs. This distinction occasionally requires writing functions in a tail-recursive style that may be more complex and slower than the natural, non-tail-recursive definition. This work describes our implementation of the tail modulo constructor (TMC) transformation in the OCaml compiler, an optimization that provides stack-efficiency for a larger class of functions—tail-recursive modulo constructors—which includes in particular the natural definition of `List.map` and many similar recursive data-constructing functions. We prove the correctness of this program transformation in a simplified setting—a small untyped calculus—that captures the salient aspects of the OCaml implementation. Our proof is mechanized in the Coq proof assistant, using the Iris base logic. An independent contribution of our work is an extension of the Simuliris approach to define simulation relations that support different calling conventions. To our knowledge, this is the first use of Simuliris to prove the correctness of a compiler transformation.

2025
  • Clément Allain
  • Frédéric Bour
  • Basile Clément
  • François Pottier
  • Gabriel Scherer
  • Read Online

    Efficient OCaml Compilation with Flambda 2

    Flambda 2 is an IR and optimisation pass for OCaml centred around inlining. We discuss the engineering constraints that shaped it and the overall structure that allows the compiler to be fast enough to handle very large industrial code bases.

    2023
  • Vincent Laviron
  • Pierre Chambart
  • Mark Shinwell
  • Read Online

    Flambda 2 Types: An Abstract Domain for Static Analysis of Functional Programs

    In this talk, we will present an overview of the abstract domains that drive the Flambda 2 optimiser for OCaml programs. Like most optimising compilers, Flambda 2 relies on static analysis to find optimisation opportunities. There are several different analyses that are actually performed. Here we will focus on a forward value analysis that we call Flambda 2 Types. Despite its name, it fits quite well the definition of an abstract domain (in the sense of abstract interpretation), and it is through that angle that we will introduce it.

    2023
  • Vincent Laviron
  • Pierre Chambart
  • Mark Shinwell
  • View Online Read Online

    Unboxed Data Constructors: Or, How cpp Decides a Halting Problem

    We propose a new language feature for ML-family languages, the ability to selectively unbox certain data constructors, so that their runtime representation gets compiled away to just the identity on their argument. Unboxing must be statically rejected when it could introduce confusion, that is, distinct values with the same representation. We discuss the use-case of big numbers, where unboxing allows to write code that is both efficient and safe, replacing either a safe but slow version or a fast but unsafe version. We explain the static analysis necessary to reject incorrect unboxing requests. We present our prototype implementation of this feature for the OCaml programming language, discuss several design choices and the interaction with advanced features such as Guarded Algebraic Datatypes. Our static analysis requires expanding type definitions in type expressions, which is not necessarily normalizing in presence of recursive type definitions. In other words, we must decide normalization of terms in the first-order λ-calculus with recursion. We provide an algorithm to detect non-termination on-the-fly during reduction, with proofs of correctness and completeness. Our algorithm turns out to be closely related to the normalization strategy for macro expansion in the cpp preprocessor.

    2023
  • Nicolas Chataing
  • Stephen Dolan
  • Gabriel Scherer
  • Jeremy Yallop
  • Read Online

    Wasocaml: A Compiler From OCaml to WebAssembly

    In this presentation, we will explore the compilation of garbage-collected languages, such as Java or OCaml, to WebAssembly (Wasm). The limitations of JavaScript as the web’s default language led to the development of Wasm, a secure and predictable-performance modular language. However, compiling garbage-collected languages to Wasm presents challenges, including the need to compile or re-implement the runtime and difficulties in transferring verified properties. Various techniques for representing values in memory are discussed, with a focus on OCaml’s approach. An extension called Wasm-GC is introduced, enabling the compilation of garbage-collected languages to Wasm by incorporating features like `int31` and garbage-collected structs. The paper presents Wasocaml, a complete OCaml compiler for Wasm-GC, and discusses benchmarks and future work in compiling garbage-collected languages to WebAssembly.

    2023
  • Léo Andrès
  • Pierre Chambart
  • Read Online

    Supporting a Decade of Opam

    Opam 1.2 was released in 2014. It was four years before opam 2.0 succeeded it, and another three for opam 2.1. The release of opam 2.2 is imminent and will have arrived just a year after its predecessor. This talk presents features added to opam 2.1 intended to make dealing with multiple versions of opam easier. We see how small additional metadata, both stored in `.opam` “roots” and also added to opam’s command line to provide opam’s developers with the chance to add new features more easily, with confidence that users will be able to upgrade safely. In presenting this, we’ll also trumpet some of what we think are the amazing new features of opam 2.1 (and 2.2) and why we think you should keenly watch for new releases and upgrade immediately on release!

    2022
  • David Allsopp
  • Raja Boujbel
  • Kate Deplaix
  • Louis Gesbert
  • View Online

    A Separation Logic for Effect Handlers

    User-defined effects and effect handlers are advertised and advocated as a relatively easy-to-understand and modular approach to delimited control. They offer the ability of suspending and resuming a computation and allow information to be transmitted both ways between the computation, which requests a certain service, and the handler, which provides this service. Yet, a key question remains, to this day, largely unanswered: how does one modularly specify and verify programs in the presence of both user-defined effect handlers and primitive effects, such as heap-allocated mutable state? We answer this question by presenting a Separation Logic with built-in support for effect handlers, both shallow and deep. The specification of a program fragment includes a protocol that describes the effects that the program may perform as well as the replies that it can expect to receive. The logic allows local reasoning via a frame rule and a bind rule. It is based on Iris and inherits all of its advanced features, including support for higher-order functions, user-defined ghost state, and invariants. We illustrate its power via several case studies, including (1) a generic formulation of control inversion, which turns a producer that ``pushes'' elements towards a consumer into a producer from which one can ``pull'' elements on demand, and (2) a simple system for cooperative concurrency, where several threads execute concurrently, can spawn new threads, and communicate via promises.

    2021
  • Paulo Emílio de Vilhena
  • François Pottier
  • Download PDF

    A practical mode system for recursive definitions

    In call-by-value languages, some mutually-recursive definitions can be safely evaluated to build recursive functions or cyclic data structures, but some definitions (let rec x = x + 1) contain vicious circles and their evaluation fails at runtime. We propose a new static analysis to check the absence of such runtime failures. We present a set of declarative inference rules, prove its soundness with respect to the reference source-level semantics of Nordlander, Carlsson, and Gill [2008], and show that it can be directed into an algorithmic backwards analysis check in a surprisingly simple way. Our implementation of this new check replaced the existing check used by the OCaml programming language, a fragile syntactic criterion which let several subtle bugs slip through as the language kept evolving. We document some issues that arise when advanced features of a real-world functional language (exceptions in first-class modules, GADTs, etc.) interact with safety checking for recursive definitions.

    2021
  • Alban Reynaud
  • Gabriel Scherer
  • Jeremy Yallop
  • Read Online

    Digodoc and Docs

    In this talk, we will introduce a new tool called digodoc, that builds a graph of an opam switch, associating files, libraries, and opam packages into a cyclic graph of inclusions and dependencies. We will then explain how we used that tool to build a documentation website that displays the generated documentation of a large set of opam packages from the official opam repository. Thanks to digodoc, users can easily navigate between module documentations, sources, packages, and libraries. We think it is an interesting contribution to the OCaml ecosystem.

    2021
  • Mohamed Hernouf
  • Fabrice Le Fessant
  • Thomas Blanc
  • Louis Gesbert
  • View Online

    Formal Verification of a Concurrent Bounded Queue in a Weak Memory Model

    We use Cosmo, a modern concurrent separation logic, to formally specify and verify an implementation of a multiple-producer multiple-consumer concurrent queue in the setting of the Multicore OCaml weak memory model. We view this result as a demonstration and experimental verification of the manner in which Cosmo allows modular and formal reasoning about advanced concurrent data structures. In particular, we show how the joint use of logically atomic triples and of Cosmo's views makes it possible to describe precisely in the specification the interaction between the queue library and the weak memory model.

    2021
  • Glen Mével
  • Jacques-Henri Jourdan
  • Download PDF

    Retrofitting Effect Handlers Onto OCaml

    Effect handlers have been gathering momentum as a mechanism for modular programming with user-defined effects. Effect handlers allow for non-local control flow mechanisms such as generators, async/await, lightweight threads, and coroutines to be composably expressed. We present a design and evaluate a full-fledged efficient implementation of effect handlers for OCaml, an industrial-strength multi-paradigm programming language. Our implementation strives to maintain the backwards compatibility and performance profile of existing OCaml code. Retrofitting effect handlers onto OCaml is challenging since OCaml does not currently have any non-local control flow mechanisms other than exceptions. Our implementation of effect handlers for OCaml: (i) imposes a mean 1% overhead on a comprehensive macro benchmark suite that does not use effect handlers; (ii) remains compatible with program analysis tools that inspect the stack; and (iii) is efficient for new code that makes use of effect handlers.

    2021
  • K. C. Sivaramakrishnan
  • Stephen Dolan
  • Leo White
  • Tom Kelly
  • Sadiq Jaffer
  • Anil Madhavapeddy
  • Download PDF

    `opam-bin`: Binary Packages With opam

    In this talk, we will present `opam-bin`, an opam plugin that builds binary opam packages on the fly to speed-up reinstallation of packages. `opam-bin` also creates opam repositories for these binary packages in order to make them easy to share with other users. We will show how it works and how to use it on a daily basis.

    2021
  • Fabrice Le Fessant
  • Download PDF

    A Declarative Syntax Definition for OCaml

    In this talk we present our work on a syntax definition for the OCaml language in the syntax definition formalism SDF3. SDF3 supports high-level definition of concrete and abstract syntax through declarative disambiguation and definition of constructors, enabling a direct mapping to abstract syntax. Based on the SDF3 syntax definition, the Spoofax language workbench produces a complete syntax aware editor with a parser, syntax checking, parse error recovery, syntax highlighting, formatting with correct parenthesis insertion, and syntactic completion. The syntax definition should provide a good basis for experiments with the design of OCaml and the development of further tooling. In the talk we will highlight interesting aspects the syntax definition, discuss issues we encountered in the syntax of OCaml, and demonstrate the editor.

    2020
  • Luis Eduardo de Souza Amorim
  • Eelco Visser
  • View Online

    A Simple State-Machine Framework for Property-Based Testing in OCaml

    Since their inception state-machine frameworks have proven their worth by finding defects in everything from the underlying AUTOSAR components of Volvo cars to digital invoicing sys- tems. These case studies were carried out with Erlang’s commercial QuickCheck state-machine framework from Quviq, but such frameworks are now also available for Haskell, F#, Scala, Elixir, Java, etc. We present a typed state-machine framework for OCaml based on the QCheck library and illustrate a number concepts common to all such frameworks: state modeling, commands, interpreting commands, preconditions, and agreement checking.

    2020
  • Jan Midtgaard
  • Download PDF

    AD-OCaml: Algorithmic Differentiation for OCaml

    AD-OCaml is a library framework for calculating mathematically exact derivatives and deep power series approximations of almost arbitrary OCaml programs via algorithmic differentiation. Unlike similar frameworks, this includes programs with side effects, aliasing, and programs with nested derivative operators. The framework also offers implicit parallelisation of both user programs and their transformations. The presentation will provide a short introduction to the mathematical problem, the difficulties of implementing a solution, the design of the library, and a demonstration of its capabilities.

    2020
  • Markus Mottl
  • View Online

    API Migration: Compare Transformed

    In this talk we describe our experience in using an automatic API-migration strategy dedicated at changing the signatures of OCaml functions, using the Rotor refactoring tool for OCaml. We perform a case study on open source Jane Street libraries by using Rotor to refactor comparison functions so that they return a more precise variant type rather than an integer. We discuss the difficulties of refactoring the Jane Street code base, which makes extensive use of PPX macros, and ongoing work implementing new refactorings.

    2020
  • Joseph Harrison
  • Steven Varoumas
  • Simon Thompson
  • Reuben Rowe
  • View Online Download PDF

    Cosmo : A Concurrent Separation Logic for Multicore OCaml

    Multicore OCaml extends OCaml with support for shared-memory concurrency. It is equipped with a weak memory model, for which an operational semantics has been published. This begs the question: what reasoning rules can one rely upon while writing or verifying Multicore OCaml code? To answer it, we instantiate Iris, a modern descendant of Concurrent Separation Logic, for Multicore OCaml. This yields a low-level program logic whose reasoning rules expose the details of the memory model. On top of it, we build a higher-level logic, Cosmo, which trades off some expressive power in return for a simple set of reasoning rules that allow accessing nonatomic locations in a data-race-free manner, exploiting the sequentially-consistent behavior of atomic locations, and exploiting the release/acquire behavior of atomic locations. Cosmo allows both low-level reasoning, where the details of the Multicore OCaml memory model are apparent, and high-level reasoning, which is independent of this memory model. We illustrate this claim via a number of case studies: we verify several implementations of locks with respect to a classic, memory-model-independent specification. Thus, a coarse-grained application that uses locks as the sole means of synchronisation can be verified in the Concurrent-Separation-Logic fragment of Cosmo, without any knowledge of the weak memory model.

    2020
  • Glen Mével
  • Jacques-Henri Jourdan
  • François Pottier
  • Download PDF

    Irmin v2

    Irmin is an OCaml library for building distributed databases with the same design principles as Git. Existing Git users will find many familiar features: branching/merging, immutable causal history for all changes, and the ability to restore to any previous state. Irmin v2 adds new accessibility methods to the store: we can now use Irmin from a CLI, or in a browser using `irmin-graphql`. It also has a new backend, `irmin-pack`, which is optimised for space usage and is used by the Tezos blockchain.

    2020
  • Clément Pascutto
  • Ioana Cristescu
  • Craig Ferguson
  • Thomas Gazagnaire
  • Romain Liautaud
  • View Online View Online

    LexiFi Runtime Types

    LexiFi maintains an OCaml compiler extension that enables introspection through runtime type representations. Recently, we implemented a syntax extension (PPX) that enables the use of LexiFi runtime types on vanilla compilers. We propose to present our publicly available runtime types and their features. Most notably, we want to present a mechanism for pattern matching on runtime types with holes.

    2020
  • Patrik Keller
  • Marc Lasson
  • View Online Download PDF View Online

    OCaml Under the Hood: SmartPy

    SmartPy is a complete system to develop smart-contracts for the Tezos blockchain. It is an embedded EDSL in Python to write contracts and their tests scenarios. It includes an online IDE, a chain explorer, and a command line interface. Python is used to generate programs in an imperative, type inferred, intermediate language called SmartML. SmartML is also the name of the OCaml library which provides an interpreter, a compiler to Michelson (the smart-contract language of Tezos), as well as a scenario “on-chain” interpreter. The IDE uses a mix of OCaml built with `js_of_ocaml` and pure Javascript. The command line interface also builds with `js_of_ocaml` to run on Node.js.

    2020
  • Sebastien Mondet
  • View Online Download PDF

    OCaml-CI: A Zero-Configuration CI

    OCaml-CI is a CI service for OCaml projects. It uses metadata from the project’s opam and `dune` files to work out what to build, and it uses caching to make builds fast. It automatically tests projects against multiple OCaml versions and OS platforms. The CI has been deployed on around 50 projects so far on GitHub, and many of them see response times an order of magnitude quicker than with less integrated CI solutions. This talk will introduce the CI service and then look at some of the technologies used to build it.

    2020
  • Thomas Leonard
  • Craig Ferguson
  • Kate Deplaix
  • Magnus Skjegstad
  • Anil Madhavapeddy
  • View Online

    Parallelising Your OCaml Code with Multicore OCaml

    With the availability of multicore variants of the recent OCaml versions (4.10 and 4.11) that maintain backwards compatibility with the existing OCaml C-API, there has been increasing interest in the wider OCaml community for parallelising existing OCaml code.

    2020
  • Sadiq Jaffer
  • Sudha Parimala
  • KC Sivaramarkrishnan
  • Tom Kelly
  • Anil Madhavapeddy
  • Download PDF View Online

    Retrofitting Parallelism onto OCaml

    OCaml is an industrial-strength, multi-paradigm programming language, widely used in industry and academia. OCaml is also one of the few modern managed system programming languages to lack support for shared memory parallel programming. This paper describes the design, a full-fledged implementation and evaluation of a mostly-concurrent garbage collector (GC) for the multicore extension of the OCaml programming language. Given that we propose to add parallelism to a widely used programming language with millions of lines of existing code, we face the challenge of maintaining backwards compatibility -- not just in terms of the language features but also the performance of single-threaded code running with the new GC. To this end, the paper presents a series of novel techniques and demonstrates that the new GC strikes a balance between performance and feature backwards compatibility for sequential programs and scales admirably on modern multicore processors.

    2020
  • KC Sivaramakrishnan
  • Stephen Dolan
  • Leo White
  • Sadiq Jaffer
  • Tom Kelly
  • Anmol Sahoo
  • Sudha Parimala
  • Atul Dhiman
  • Anil Madhavapeddy
  • Download PDF

    The Final Pieces of the OCaml Documentation Puzzle

    `odoc` is the latest attempt at creating a documentation tool which handles the full complexity of the OCaml language. It has been a long time coming as tackling both the module system and rendering into rich documents makes for a difficult task. Nevertheless we believe the two recent developments provides the final pieces of the OCaml documentation puzzle. This two improvements split `odoc` in two layers: a model layer, with a deep understanding of the module system, and a document layer allowing for easy definition of new outputs.

    2020
  • Jonathan Ludlam
  • Gabriel Radanne
  • Leo White
  • View Online

    The ImpFS Filesystem

    This proposal describes a presentation to be given at the OCaml’20 workshop. The presentation will cover a new OCaml filesystem, ImpFS, and the related libraries. The filesystem makes use of a B-tree library presented at OCaml’17 and a key-value store presented at ML’19. In addition, there are a number of other support libraries that may be of interest to the community. ImpFS represents a single point in the filesystem design space, but we hope that the libraries we have developed will enable others to build further filesystems with novel features.

    2020
  • Tom Ridge
  • View Online

    Types in Amber

    Coda is a new cryptocurrency that uses zk-SNARKs to dramatically reduce the size of data needed by nodes running its protocol. Nodes communicate in a format automatically derived from type definitions in OCaml source files. As the Coda software evolves, these formats for sent data may change. We wish to allow nodes running older versions of the software to communicate with newer versions. To achieve that, we identify stable types that must not change over time, so that their serialisations also do not change.

    2020
  • Paul Steckler
  • Matthew Ryan
  • View Online

    Chemoinformatics and Structural Bioinformatics in OCaml

    In this article, we share our experience in prototyping chemoinformatics and structural bioinformatics software in OCaml

    2019

    industrial

    application

    bioinformatics

  • François Berenger
  • Kam Y. J. Zhang
  • Yoshihiro Yamanishi
  • View Online

    Extending OCaml's `open`

    We propose a harmonious extension of OCaml's `open` construct. OCaml's existing construct `open M` imports the names exported by the module `M` into the current scope. At present `M` is required to be the path to a module. We propose extending `open` to instead accept an arbitrary module expression, making it possible to succinctly address a number of existing scope-related difficulties that arise when writing OCaml programs.

    2019

    ocaml-workshop

    core

    language

  • Runhang Li
  • Jeremy Yallop
  • Download PDF

    Bounding Data Races in Space and Time

    We propose a new semantics for shared-memory parallel programs that gives strong guarantees even in the presence of data races. Our local data race freedom property guar- antees that all data-race-free portions of programs exhibit sequential semantics. We provide a straightforward oper- ational semantics and an equivalent axiomatic model, and evaluate an implementation for the OCaml programming language. Our evaluation demonstrates that it is possible to balance a comprehensible memory model with a reasonable (no overhead on x86, ~0.6% on ARM) sequential performance trade-off in a mainstream programming language

    2018
  • Stephen Dolan
  • KC Sivaramakrishnan
  • Anil Madhavapeddy
  • Download PDF

    Merlin: A Language Server for OCaml (Experience Report)

    We report on the experience of developing Merlin, a language server for the OCaml programming language in development since 2013. Merlin is a daemon that connects to your favourite text editor and provides services that require a fine-grained understanding of the programming language syntax and static semantics: instant feedback on warnings and errors, autocompletion, 'type of the code under the cursor', 'go to definition', etc. Language servers need to handle incomplete and partially-incorrect programs, and try to be incremental to minimize recomputation after small editing actions. Merlin was built by carefully adapting the existing tools (the OCamllex lexer and Menhir parser generators) to better support incrementality, incompleteness and error handling. These extensions are elegant and general, as demonstrated by the interesting, unplanned uses that the OCaml community found for them. They could be adapted to other frontends -- in any language. Besides incrementality, we discuss the way Merlin communicates with editors, describe the design decisions that went into some demanding features and report on some of the non-apparent difficulties in building good editor support, emerging from expressive programming languages or frustrating tooling ecosystems. We expect this experience report to be of interest to authors of interactive language tooling for any programming language; many design choices may be reused, and some hard-won lessons can serve as warnings.

    2018
  • Frédéric Bour
  • Thomas Refis
  • Gabriel Scherer
  • Read Online

    A Memory Model for Multicore OCaml

    We propose a memory model for OCaml, broadly following the design of axiomatic memory models for languages such as C++ and Java, but with a number of differences to provide stronger guarantees and easier reasoning to the programmer, at the expense of not admitting every possible optimisation.

    2017
  • Stephen Dolan
  • KC Sivaramakrishnan
  • Download PDF

    Tezos: the OCaml Crypto-Ledger

    In this talk, we will present the story of the Tezos project. Tezos is a crypto-ledger, i.e. a distributed blockchain with a language to express smart contracts, with two specific characteristics: the first one is its ability for self-amendment, that allows a majority of stake-holders to update the behavior of Tezos without risking a fork; the second one is a design and implementation (in OCaml) that took into account safety and security from the very beginning, and in particular the use of static typing and formal methods when possible. For example, Michelson, the smart contract language of Tezos, is the only such language with a formal semantics, a type system ensuring no runtime errors, and an implementation that uses OCaml GADTs to ensure its correctness

    2017
  • Benjamin Canou
  • Grégoire Henry
  • Pierre Chambart
  • Fabrice Le Fessant
  • Arthur Breitman
  • Download Paper in PDF

    Eff Directly in OCaml

    The language Eff is an OCaml-like language serving as a prototype implementation of the theory of algebraic effects, intended for experimentation with algebraic effects on a large scale. We present the embedding of Eff into OCaml, using the library of delimited continuations or the Multicore OCaml branch. We demonstrate the correctness of the embedding denotationally, relying on the tagless-final-style interpreter-based denotational semantics, including the novel, direct denotational semantics of multi-prompt delimited control. The embedding is systematic, lightweight, performant, and supports even higher-order, 'dynamic' effects with their polymorphism. OCaml thus may be regarded as another implementation of Eff, broadening the scope and appeal of that language.

    2016

    ocaml-workshop

    core

    language

  • Oleg Kiselyov
  • KC Sivaramakrishnan
  • Download PDF

    Learn OCaml: An Online Learning Center for OCaml

    We present Learn OCaml, a Web application that packs a set of learning activities for people who want to learn OCaml. It includes an integrated and reworked version of the venerable Try OCaml and an exercise environment with automated grading derived from the one developed for the OCaml MOOC. It works entirely in the browser, the server being used for storing static files and synchronising between different devices. A special effort has been made to make it usable on tablets and even mobiles. A main public instance will be hosted at OCamlPro, but the project is open-source, and universities can host their own version on site. We will also provide a public repository for teachers to contribute lessons and exercises.

    2016
  • Benjamin Canou
  • Grégoire Henry
  • Çagdas Bozman
  • Fabrice Le Fessant
  • View Online Read Online

    OPAM-builder: Continuous Monitoring of OPAM Repositories

    In this talk, we will present the opam-builder system. opam-builder is an online service that monitors the official OPAM repository, continuously builds all versions of all packages for 6 different versions of OCaml, and display html reports with all the information about failed installations. It can be used both by repository maintainers and package developers as a useful tool to improve the quality of the OPAM repository

    2016
  • Fabrice Le Fessant
  • View Video Download Paper in PDF

    The State of the OCaml Platform: September 2016

    Louis Gesbert covers the current state of the OCaml Platform in September 2016. Introducing the game-changing integrations to opam 2.0, the roadmap, and many more an aspects of the OCaml Platform as a whole like `opam-publish`.

    2016
  • Louis Gesbert, on behalf of the OCaml Platform team
  • Anil Madhavapeddy
  • View Online

    ocp-lint, A Plugin-based Style-Checker with Semantic Patches

    In this talk, we will present ocp-lint, a new style-checker for OCaml projects. ocp-lint can typically be used to check pull-requests in a Github-style workflow. ocp-lint is highly extensible, with a simple API to define new plugins that can be linked dynamically. ocp-lint is easily configurable, with plugin- and analysis-specific options and arguments. ocp-lint can also use semantic patches, a patch-style format to describe code patterns to detect. Warnings found by ocp-lint are stored in a database, to avoid useless recomputations and ease the development of external tools and GUIs to exploit its results

    2016
  • Çagdas Bozman
  • Théophane Hufschmitt
  • Michael Laporte
  • Fabrice Le Fessant
  • Download Paper in PDF

    Global Semantic Analysis on OCaml programs

    We present an ongoing project at OCamlPro, the development of a semantic analyser of OCaml code based on abstract interpretation techniques. This analysis relies on the presence of the whole program at compile time, it should work on full actual programs and shows interesting promises in terms of uncaught exceptions detection.

    2015
  • Thomas Blanc
  • Pierre Chambart
  • Michel Mauny
  • Fabrice Le Fessant
  • View Online

    Operf: Benchmarking the OCaml Compiler

    We present operf, a set of tools to benchmark the OCaml compiler, with both micro- benchmarks, for fast feedback during development, and macro-benchmarks, for results on a larger set of benchmarks.

    2015
  • Pierre Chambart
  • Fabrice Le Fessant
  • Vincent Bernardoff
  • View Video Download Paper in PDF

    Towards A Debugger for Native-Code OCaml

    In this talk, we will present a starting project at OCamlPro, the development of a debugging framework for OCaml native-code applications, based on the LLDB Debugger, a debugger built on top of the LLVM framework. We implemented a complete binding of LLDB C++ API for OCaml, and then used it to build several tools, one "generic" debugger, and two small utilities to monitor the memory behavior of OCaml applications.

    2015
  • Fabrice Le Fessant
  • Pierre Chambart
  • View Online Read Online

    A Case for Multi-Switch Constraints in OPAM

    Package managers usually only deal with packages and their versions, and the constraints on their dependencies towards other packages’ versions. Among package managers, opam is probably the first one to introduce the notion of switch, i.e. the ability to manage different directories, where different sets of packages with different versions are installed, as each directory is treated as an independant universe when solving dependency constraints. In this talk, we will support a case to be able, in opam, to manage different switches in the same universe, allowing to express dependency constraints that cross switch boundaries.

    2014
  • Fabrice Le Fessant
  • Download Paper in PDF

    A Proposal for Non-Intrusive Namespaces in OCaml

    We present a work-in-progress about adding namespaces to OCaml. Inspired by other languages such as Scala or C++, our aim is to design and formalise a simple and non-intrusive namespace mechanism without complexifying the core language. Namespaces in our approach are a simple way to define libraries while avoiding name clashes. They are also meant to simplify the build process, clarifying and reducing (to zero whenever possible) the responsibility of external tools.

    2014
  • Pierrick Couderc
  • Fabrice Le Fessant
  • Benjamin Canou
  • Pierre Chambart
  • View Online Read Online

    The OCaml Platform v1.0

    The OCaml Platform combines the OCaml compiler toolchain with a coherent set of tools for build, documentation, testing, and IDE integration. The project is a collaborative effort across the OCaml community, tied together by the OCaml Labs group in Cambridge and with other major contributors listed above. The requirements of the Platform are being guided by the industrial OCaml Consortium (primarily Jane Street, Citrix, and Lexifi). This talk follows up the OCaml 2013 talk that introduced the Platform. Since then, many tools have been released in parallel via the opam package manager, and this year’s talk will demonstrate the concrete workflow that ties them together (see Figure 2). We will first recap the Platform ethos briefly, update on the opam package manager v1.2 and conclude with the Platform workflow.

    2014
  • Anil Madhavapeddy
  • Amir Chaudhry
  • Jeremie Diminio
  • Thomas Gazagnaire
  • Louis Gesbert
  • Thomas Leonard
  • David Sheets
  • Mark Shinwell
  • Leo White
  • Jeremy Yallop
  • View Online

    Using Preferences to Tame your Package Manager

    Determining whether some components can be installed on a system is a complex problem: not only it is NP-complete in the worst case, but there can also be exponentially many solutions to it. Ordinary package managers use ad-hoc heuristics to solve this installation problem and choose a particular solution, making extremely difficult to change or sidestep these heuristics when the result is not the one we expect. When software repositories become complex enough, one gets vastly superior results by delegating dependency handling to a specialised solver, and use optimisation functions (or preferences) to control the class of solutions that are found. The opam package manager relies on the CUDF pivot format, which allows OCaml users that have a CUDF-compliant solver on their machine to reap the benefits of preferences- based dependency resolution. Thanks to the solver farm provided by Irill, these benefits are now extended to the OCaml community at large. In this talk we will present the preferences language and explain how to use it.

    2014
  • Roberto Di Cosmo
  • Pietro Abate
  • Stefano Zacchiroli
  • Fabrice Le Fessant
  • Louis Gesbert
  • Download Paper in PDF

    Improving OCaml High-Level Optimisations

    I spend a lot of time hacking the OCaml compiler. Hence when I write some code, I have a good glimpse of what the generated assembly will look like. This is nice when I want to write performance sensitive code, but as I usually write code for which execution time doesn't matter much, this mainly tends to torture me. A small voice in my head is telling me "you shouldn't write it like that, you known you could avoid this allocation." And usually, following that indication would only tend to make the code less readable. But there is a solution to calm that voice\: making the compiler smarter than me. OCaml compilation mechanisms are quite predictable. There is no dark magic to replace your ugly code by a well-behaving one, but it always generates reasonably efficient code. This is a good thing in general, as you won't be surprised by code running more slowly than what you usually expect. But it does not behave very well with dumb code. This may not often seem like a problem with code written by humans, but generated code, for example coming from camlp4/ppx, or compiled from another language to OCaml, may fall into that category. In fact, there is another common source for non-human written code: inlining.

    2013

    ocaml-workshop

    optimisation

  • Pierre Chambart
  • Download PDF Download PDF

    OCamlot: OCaml Online Testing

    OCamlot provides a distributed, continuous testing service for opam package quality and compatibility. Using signals from GitHub, OCamlot ensures that, before being merged, patches submitted to the opam repository are thoroughly tested on the variety of supported configurations, architectures, and systems. The resulting improved build and metadata quality in turn speeds up development on other aspects of the Platform through earlier error feedback. A high-quality package repository is also very important for new user retention.

    2013
  • David Sheets
  • Anil Madhavapeddy
  • Amir Chaudhry
  • Thomas Gazagnaire
  • Download PDF Download PDF

    Profiling the Memory Usage of OCaml Applications Without Changing Their Behavior

    In this paper, we present the current state of our work on profiling the memory usage of OCaml programs. Our technique allows to observe track types, allocation points, and reachability paths of blocks with no runtime cost, except for saving the observations.

    2013
  • Çagdas Bozman
  • Michel Mauny
  • Fabrice Le Fessant
  • Thomas Gazagnaire
  • Download PDF Slides Download PDF

    The design of the wxOCaml library

    WxWidgets is a well-known cross-platform library to build graphical user interfaces for desktop applications. It has bindings for many languages, among which the most famous is probably WxPython, but not for OCaml. Binding such a library is a huge — error-prone — work, because, to be useful, hundreds of C++ classes with tens of methods have to be accessible though the binding. In this paper, we show how this problem was solved in the case of wxOCaml, providing an easy to use, easy to extend binding supporting multiple versions of WxWidgets.

    2013
  • Fabrice Le Fessant
  • Download Paper in PDF Download Slides in PDF

    OCamlPro: Promoting OCaml Use in Industry

    One year after the foundation of OCamlPro, Fabrice Le Fessant presents at the OCaml Workshop a brief summary of the tasks undertaken in the span of that fateful year. Cheat Sheets, opam package manager, and many more are the start of a long stream of contributions for the OCaml Distribution and Community at large.

    2012
  • Fabrice Le Fessant
  • View Online

    Study of OCaml Programs' memory behavior

    A two-fold presentation covering both a study of OCaml programs' memory behaviour and the development of memory profiling tools that were on-going at OCamlPro at the time. These works aimed at decreasing memory footprint, pinpoint and fix memory leaks, and decrease the amount of time spent in memory management at runtime.

    2012
  • Çagdas Bozman
  • Thomas Gazagnaire
  • Fabrice Le Fessant
  • Michel Mauny
  • View Online Read Online

    opam: An OCaml Package Manager

    Six months after the start of the development of the opam package manager, Frederick Tuong, Fabrice Le Fessant, and Thomas Gazagnaire present for the first time what would in time become the official package manager for the OCaml Distribution. Covering the current state of the repository, and future prospects for the platform, this small piece of media witholds a significant piece of history for OCaml.

    2012
  • Frederic Tuong
  • Fabrice Le Fessant
  • Thomas Gazagnaire
  • View Online

    OCaml for the Masses

    Why the next language you learn should be functional.

    2011
  • Yaron Minsky
  • View Online

    Meta-Programming Tutorial with CamlP4

    Meta-programming tutorial with Camlp4

    2010
  • Jake Donham
  • View Online

    Xen and the Art of OCaml

    In this talk, we will firstly describe the architecture of XenServer and the XenAPI and discuss the challenges faced with implementing an Objective Caml based solution. These challenges range from the low-level concerns of interfacing with Xen and the Linux kernel, to the high-level algorithmic problems such as distributed failure planning. In addition, we will discuss the challenges imposed by using OCaml in a commercial environment, such as supporting product upgrades, enhancing supportability, and scaling the development team.

    2008
  • Anil Madhavapeddy
  • Download PDF

    The Essence of ML Type Inference

    This book chapter gives an in-depth abstract of the Core ML type system, with an emphasis on type inference. The type inference algorithm is described as the composition of a constraint generator, which produces a system of type equations, and a constraint solver, which is presented as a set of rewrite rules.

    2005
  • François Pottier
  • Didier Rémy
  • Download PostScript

    Relaxing the Value Restriction

    This paper explains why it is sound to generalise certain type variables at a `let` binding, even when the expression that is being `let`-bound is not a value. This relaxed version of Wright's classic “value restriction” was introduced in OCaml 3.07.

    2004
  • Jacques Garrigue
  • Download PDF Download PostScript

    Typing Deep Pattern-matching in Presence of Polymorphic Variants

    This paper provides more details about the technical machinery behind polymorphic variants, focusing on the rules for typechecking deep pattern matching constructs.

    2004

    core

    language

    polymorphic variants

  • Jacques Garrigue
  • Download PDF Download PostScript

    A Proposal for Recursive Modules in Objective Caml

    This note describes the experimental recursive modules introduced in OCaml 3.07.

    2003
  • Xavier Leroy
  • Download PDF Download PostScript

    Simple Type Inference for Structural Polymorphism

    This paper explains most of the typechecking machinery behind polymorphic variants. At its heart is an extension of Core ML's type discipline with so-called local constraints.

    2002

    core

    language

    polymorphic variants

  • Jacques Garrigue
  • Download PDF Download PostScript

    Labeled and Optional Arguments for Objective Caml

    This paper offers a dynamic semantics, a static semantics, and a compilation scheme for OCaml's labeled and optional function parameters.

    2001
  • Jacques Garrigue
  • Download PDF Download PostScript Download DVI

    Optimizing Pattern Matching

    All you ever wanted to know about the garbage collector found in Caml Light and OCaml's runtime system.

    2001
  • Fabrice Le Fessant
  • Luc Maranget
  • View Online

    A Modular Module System

    This accessible paper describes a simplified implementation of the OCaml module system, emphasizing the fact that the module system is largely independent of the underlying core language. This is a good tutorial to learn both how modules can be used and how they are typechecked.

    2000
  • Xavier Leroy
  • Download PDF Download PostScript Download DVI

    Code Reuse Through Polymorphic Variants

    This short paper explains how to design a modular, extensible interpreter using polymorphic variants.

    2000

    core

    language

    polymorphic variants

  • Jacques Garrigue
  • Download PostScript

    Extending ML with Semi-Explicit Higher-Order Polymorphism

    This paper proposes a device for re-introducing first-class polymorphic values into ML while preserving its type inference mechanism. This technology underlies OCaml's polymorphic methods.

    1999
  • Jacques Garrigue
  • Didier Rémy
  • Download PDF Download PostScript Download DVI

    Objective ML: An Effective Object-Oriented Extension to ML

    This paper provides theoretical foundations for OCaml's object-oriented layer, including dynamic and static semantics.

    1998
  • Didier Rémy
  • Jérôme Vouillon
  • Download PDF Download PostScript Download DVI

    Programming with Polymorphic Variants

    This paper briefly explains what polymorphic variants are about and how they are compiled.

    1998

    core

    language

    polymorphic variants

  • Jacques Garrigue
  • Download PDF Download PostScript

    The Effectiveness of Type-based Unboxing

    This paper surveys and compares several data representation strategies, including the one used in the OCaml native-code compiler.

    1997
  • Xavier Leroy
  • Download PDF Download PostScript

    Applicative Functors and Fully Transparent Higher-Order Modules

    This work extends the above paper by introducing so-called applicative functors, that is, functors that produce compatible abstract types when applied to provably equal arguments. Applicative functors are also a feature of OCaml.

    1995
  • Xavier Leroy
  • Download PDF Download PostScript Download DVI

    Conception, Réalisation et Certification d'un Glaneur de Cellules Concurrent

    All you ever wanted to know about the garbage collector found in Caml Light and OCaml's runtime system.

    1995

    garbage collection

    runtime

  • Damien Doligez
  • Georges Gonthier
  • Download PDF Download PostScript

    A Syntactic Approach to Type Soundness

    This paper describes the semantics and the type system of Core ML and uses a simple syntactic technique to prove that well-typed programs cannot go wrong.

    1994
  • Andrew K. Wright
  • Matthias Felleisen
  • Download PostScript

    Manifest Types, Modules, and Separate Compilation

    This paper presents a variant of the Standard ML module system that introduces a strict distinction between abstract and manifest types. The latter are types whose definitions explicitly appear as part of a module interface. This proposal is meant to retain most of the expressive power of the Standard ML module system, while providing much better support for separate compilation. This work sets the formal bases for OCaml's module system.

    1994
  • Xavier Leroy
  • Download PDF Download PostScript Download DVI

    Portable, Unobtrusive Garbage Collection for Multiprocessor Systems

    This paper describes a concurrent version of the garbage collector found in Caml Light and OCaml's runtime system.

    1994

    garbage collection

    runtime

  • Damien Doligez
  • Georges Gonthier
  • Download PDF Download PostScript

    A Concurrent, Generational Garbage Collector for a Multithreaded Implementation of ML

    Superseded by "Portable, Unobtrusive Garbage Collection for Multiprocessor Systems"

    1993

    garbage collection

    runtime

  • Damien Doligez
  • Xavier Leroy
  • Download PDF Download PostScript

    The ZINC Experiment, an Economical Implementation of the ML Language

    This report contains a abstract of the ZINC compiler, which later evolved into Caml Light, then into OCaml. Large parts of this report are out of date, but it is still valuable as a abstract of the abstract machine used in Caml Light and (with some further simplifications and speed improvements) in OCaml.

    1990
  • Xavier Leroy
  • Download PDF Download PostScript