Generic Programming in OCaml

12/31/2018
by   Florent Balestrieri, et al.
0

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.

READ FULL TEXT
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

06/02/2021

Generic Programming with Combinators and Objects

We present a generic programming framework for OCAML which makes it poss...
06/19/2017

Generic Approach to Certified Static Checking of Module-like Constructs

In this paper we consider the problem of certified static checking of mo...
03/10/2021

Evaluating Linear Functions to Symmetric Monoidal Categories

A number of domain specific languages, such as circuits or data-science ...
10/15/2021

Zipping Strategies and Attribute Grammars

Strategic term rewriting and attribute grammars are two powerful program...
10/12/2021

Generic Level Polymorphic N-ary Functions

Agda's standard library struggles in various places with n-ary functions...
05/17/2018

Generic Deriving of Generic Traversals

Functional programmers have an established tradition of using traversals...
11/04/2021

A thread-safe Term Library

Terms are one of the fundamental data structures for computing. E.g. eve...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.