Generic Programming in OCaml

Florent Balestrieri
Michel Mauny
(Inria Paris)

We present a library for generic programming in OCaml, adapting some techniques borrowed from other functional languages. The library makes use of three recent additions to OCaml: generalised abstract datatypes are essential to reflect types, extensible variants allow this reflection to be open for new additions, and extension points provide syntactic sugar and generate boiler plate code that simplify the use of the library. The building blocks of the library can be used to support many approaches to generic programming through the concept of view. Generic traversals are implemented on top of the library and provide powerful combinators to write concise definitions of recursive functions over complex tree types. Our case study is a type-safe deserialisation function that respects type abstraction.

In Kenichi Asai and Mark Shinwell: Proceedings ML Family Workshop / OCaml Users and Developers workshops (ML/OCAML 2016), Nara, Japan, September 22-23, 2016, Electronic Proceedings in Theoretical Computer Science 285, pp. 59–100.
Published: 31st December 2018.

ArXived at: bibtex PDF
References in reconstructed bibtex, XML and HTML format (approximated).
Comments and questions to:
For website issues: