I made a single-file port of GitHub - Mesabloo/diagnose: A simple library for reporting compiler/interpreter errors from Haskell to OCaml. It is similar to Grace and asai discussed in [ANN] Grace đź’…, fancy diagnostics library for compilers , with no external dependencies. Examples:
I used AI assistance to translate the Diagnose library: a day to get the ~1500-line module translated and compiling, and another half day to get it displaying reasonably. The Haskell original relies on an external library’s layout engine (boxes and wrapping) which I did not translate, so caveat emptor.
Aside: This was my first time using AI (GPT-4.1 in vscode) to write code. I got lucky since it seems that Haskell translation is very good, and the visual end-result of the Diagnose library makes it easy to find and fix problems. Since I very recently did a hand-translation of Haskell into OCaml I can roughly estimate translation went 2-3X faster with AI. But AI seriously messes with my mental flow for non-translation work, so I turned AI off.
If you want to use it, reply back and I’ll promote it to a standalone library and submit it to opam.
Docs: Diagnose (MlFront_Thunk.MlFront_Thunk.Diagnose)
Another single-file module is “FilePath”, which is my small but growing replacement for Stdlib Filename module. The problem I have with Filename.concat in particular is that it is not deterministic and hermetic. I run code on a Windows machine and file paths print a certain way. Then I run the same code on a mac and file paths print differently. Sometimes expect and integration tests break. It gets worse when I generate artifacts meant to be shared reproducibly between machines.
Docs: FilePath (MlFront_Core.MlFront_Core.FilePath)
Again, if you think you’ll use it, I’ll pull it into a standalone library and submit it to opam.

