Written with Javier Chávarri and Feihong Hsu.

The first Reason Conf US just ended. Many talks mentioned native compilation. Sharing code between BuckleScript and native artifacts is a use case which is more and more common. This blog post is an introduction on how to set up a library available for both worlds, sharing as much code as possible.

The goal

What we try to produce is a library with an identical interface for BuckleScript and native. But without duplicating code. …

atdgen is a project to create types and data structures that can be serialized to JSON. It is very convenient when communicating between multiple processes, creating a REST API or consuming JSON objects from other tools. It can be compared to JSON schema or Protocol Buffers, but with richer types and more features.

The idea is to write a list of types in a specification file, an .atd file. Then running atdgen, it is possible to generate OCaml or Java code to serialize/deserialize values of those types to/from corresponding json.

Until very recently, atdgen could generate code only for native…

At Ahrefs, we are doing a lot of OCaml. But sometimes, OCaml doesn’t have a specific library or is not well supported. And we have to back off to another language.

An example of such a platform without a good OCaml supports and a lack of OCaml libraries is AWS Lambda. Until now, I would probably use Typescript to write lambdas, as nodejs is well supported by AWS Lambda, a lot of libraries are available (like the aws-sdk), and typescript offers some guaranties over plain Javascript.

But recently, a new alternative appeared. ReasonML and Bucklescript offer a very nice way…

Louis Roché

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store