here you goThings I’ve made, read and saved — shared here.

Archive

9,565 entries: 46 from X, 8,923 from Pinboard, saved 1998 to 2026.

Browse by tag, site, author, folder or language

Tags

Sites

Authors

Folders

Languages

16 entries#ocaml ×

2025

2023

melange

Melange is a backend for the OCaml compiler that emits JavaScript. Melange strives to provide the best integration with both the OCaml and JavaScript ecosystems. A small write-up with more details on the motivation behind this project can be found in the announcement blog post.

A few weeks after the rebranding of BuckleScript to ReScript, António Monteiro starts working on a fork of BuckleScript with a simple (not easy) goal: replace the Ninja build system, which BuckleScript had been using from its creation, with Dune, which is the most used build system for OCaml projects.

This fork of BuckleScript is later named Melange. After finishing the switch from Ninja to Dune, several additional features are added to bring it closer to OCaml. Some examples are the upgrade of the OCaml compiler version used by Melange, or modeling the changes to the OCaml compiler that Melange uses as just a plain library, instead of a full fork of the upstream compiler.

In September 2022, Ahrefs decides to invest on Melange by funding a project to deepen the integration between Dune and Melange. This project achieves its completion in Spring 2023, with the migration of Ahrefs frontend codebase to Melange and the new public releases that support it: version 3.8 of Dune and 1.0 of Melange.

notes#melange#ocaml

dune

dune-release.md

dune-release is a good improvement over the old opam-publish, but releasing software is still clearly not a solved problem, and I find it hard to remember the exact steps involved in releasing an opam package, especially if some time has passed since the last release. This note is an attempt at having a place...

notes#dune#ocaml

2020

OCaml programming language

OCaml for the impatient . The web's quickest and dirtiest OCaml getting started guide This is the most up to date setup using Opam, jbuilder, Merlin, VSCode etc.,(. August 2017). (ed note, 2023-10-10: Since then the OCaml system has made huge strides in developer productivity.)

xvw.lol - Why I chose OCaml as my primary language, an opinion piece by a programmer that uses OCaml professionally at tarides. Is a good intro the ecosystem in 2025; via

Language

Concurrency

Learning OCaml

Courseware

Tutorials

Best practices

  • Our current OCaml best practices. -- part 1 and part 2 by Issuu Engineering; Dec 2018.

Books

Textbooks

Articles

Blogs

Resources

Papers

Package managers

OCaml Languages

Reason: a syntax for OCaml, so native development or melange development to compile to JS

ReScript: a syntax similar to Reason, but the entire toolchain. Closer to JavaScript, can't compile to native.

Talks

Yaron Minsky:

Miscellaneous

OCaml as a replacement language

Writing languages using OCaml

Tools, ecosystem and libraries

Js_of_Ocaml

  • js-skeleton -- sample project showing how to build a Javascript web-app using js_of_ocaml, TyXML and React
  • H.261 Video Decoding in OCaml. -- This notebook will demonstrate a simple H.261 Video Decoder written in OCaml and compiled to javascript with js_of_ocaml.

OCaml project tools

Build tools:

Some opinions on the merits of using these tools:

Code bits

Explicit Typing of a polymorphic variant

type download_result =
  [ `aborted_by_user
  | `network_failure of string
  | `success of filepath ]

via

Information

QQ

  • What is good about OCaml's module system?
  • What good is First class Modules?
  • "Using an error monad in a language like ocaml is superior to exceptions in almost every way." via

Sample code / Read Source

Multicore OCaml

Object oriened OCaml

Hindley-Milner type system

Semantics

Web programming with OCaml

PPX

Comparison

min-caml

esumii/min-caml: a complete optimizing native-code compiler for a reasonably usable subset of OCaml, in 2000 lines of OCaml. Paper.

Running log

PSA: Tired of inscrutable type errors from OCaml? If you use jbuilder/dune, just add this to your jbuild build stanza: (flags (:standard -short-paths)) and your type errors and inferred types from Merlin will magically improve!

NixOS

Data Science and AI

OCaml Garbage Collection

My notes

emacs + utop + merlin + typerex = Excellent IDE.

2014-11-25: Run ocamlbrowser in a shell to see a tk based documentaiton browser.

OCamlEditor

Fortunately, you can install it using opam install ocamleditor... unfortunately you are dealing with various idiosyncrasies of GTK on mac... ugh.. To keep it short, lablgtk installation by opam might fail with pkg-config errors. The fix is:

https://github.com/Homebrew/homebrew/issues/14123#issuecomment-37896791

... before running opam install ocamleditor. Solution via

Note: looks butt-ugly on mac, as expected.

opam allows you create "sandboxes" and install packages in them. See the -A --alias-of option.

See Setting up an OCaml environment for Programming. Use ocamlfind, ocamlbuild and make.

Apr 2016. See ogen -- a tool for creating new OCaml projects with OPAM, Oasis, and Merlin.

Compiling an ocaml file:

  • That has no dependecies

    ocamlopt foo.ml -o foo

  • that has a dependency (say csv)

    ocamlfind ocamlopt -o test -linkpkg -package csv test.ml

ocamlfind

  • ocamlfind is a program that finds all the ocaml packages that are installed on your system (or opam instance, for that matter).
  • ocamlfind -h to see list of commands available.
  • ocamlfind printconf shows the path configs etc.,
  • ocamlfind list will list all the packages installed.

ocamldep

typical usage: ocamldep *.ml, which will dumps dependency lines.

** Different file types **

  • .cmo --
  • .cmi --
  • .mli --

--

OCaml has good study materials -- textbooks, lecture notes. There is also the advantage of being able to roll-over to F# for "enterprise" stuff.

notes#ocaml#programming-language

Functional programming

  • (Hughes 1984); link.

Papers

Learning Functional Programming

Book reviews and suggestions

Videos

Misc

-- Xavier Leroy via

References

  • Hughes (1984). Why Functional Programming Matters.
  • Okasaki (1998). Purely Functional Data Structures.

notes#functional-programming#haskell#ocaml

2016

2014

2013

2012

2007

2006