package ocamlmig

  1. Overview
  2. Docs
OCaml source code rewriting tool

Install

Dune Dependency

Authors

Maintainers

Sources

ocamlmig-5.2-20250129.tbz
sha256=0deeac498ab94fdb7f7f6879c8b7c5554534f80fd78bdc3ac3091d31abd7fe45
sha512=ab36efb8d9ac3bca98ce964f6524feb87ec1cd106012a88e28d6002e9b6aab38f4454fd7b3fc667a104abdabcc58045139259ceb4cc3137c4d835e516010bfaf

doc/README.html

ocamlmig is a command line tool for rewriting ocaml source code with access to scope and type information.

As a simple example of what it can do, let's say an opam-installed library A provides this interface:

val new_name : int -> int

val old_name : int -> int
[@@migrate { repl = Rel.new_name }]

and your repository contains a file b.ml:

let _ = A.old_name 1

then you could do:

$ git diff b.ml
$ ocamlmig migrate -w
$ git diff b.ml
-let _ = A.old_name 1
+let _ = A.new_name 1

Examples of real rewrites:

If that piqued your interest, you can find more information about what ocamlmig does, and using it.

This is work in progress, so many things are only partially implemented, but the existing functionality as is should still be interesting.

OCaml

Innovation. Community. Security.