Shelter, Hazel and More! [weekly-2025-03-31]
- March 31, 2025
- Patrick Ferris
Last week I focused on Shelter -- our idea that shells should have the same ability as reproducible build tools like Nix or Docker. To this end I now have a fairly fleshed out prototype.
Shelter Prototype
- March 31, 2025
- Patrick Ferris
Forester Hacking
- March 31, 2025
- Patrick Ferris
As you can probably tell, my website is still using Forester. I rebased my Markdown branch to include the new Atom syndication feature.
Alongside that I added support for arbitrary HTML injection into Forester via codeblocks in Markdown. This was actually very straightforward thanks to Markup and being able to re-parse Forester syntax in the middle of converting a Markdown document. The HTML for the shell in Shelter uses this feature.
If you are interested in taking this custom Forester for a spin, there's a branch on Github. In fact, nearly the only change beyond letting the core engine know about markdown files, is adding a new parser frontend.
Hazel
- March 31, 2025
- Patrick Ferris
For one of my Part II students, I've been prototyping a transpiler from OCaml to Hazel. This has gone pretty well and now supports type annotations as well as straight-forward implementation translation.
Consider the following OCaml map function.
let rec map f = function
| [] -> []
| x :: xs -> (f x) :: map f xs
The tool, hazel_of_ocaml can translate this to Hazel code, including making the polymorphism explicit.
let map : forall a -> forall b -> (a -> b) -> [a] -> [b] = typfun a -> typfun b -> fun f -> fun x1 -> case x1 | [] => [] | x :: xs => f(x) :: map(f)(xs) end in ?
You can copy and paste that codeblock into the hazel playground. But do note that it still needs some manual editing to add the type applications in directly (map@<a>@<b>). With the right amount of type-inferencing and scoping I actually think that you could place those type applications in yourself. This could make a nice Part II project I think.
Ppxlib
- March 31, 2025
- Patrick Ferris
I recently wrote about the painful experience of miragrating ppxlib to the 5.2 OCaml AST. This week, Nathan Rebours and I merged a PR to add the 5.3 AST! Ppxlib has been playing catch-up with the compiler and we decided it was best to try to catch up quickly and deal with the ecosystem fallout all at once rather than incrementally. With this new AST merged, ppx authors can now use the new Pexp_effect parsetree node. I'll write a little more about this in a separate post soon.