<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/default.xsl"?>
<fr:tree xmlns:fr="http://www.forester-notes.org" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" root="false" base-url="/">
  <fr:frontmatter>
    <fr:authors>
      <fr:author>
        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
      </fr:author>
    </fr:authors>
    <fr:date>
      <fr:year>2025</fr:year>
      <fr:month>10</fr:month>
      <fr:day>24</fr:day>
    </fr:date>
    <fr:uri>https://patrick.sirref.org/icfp-2025/</fr:uri>
    <fr:display-uri>icfp-2025</fr:display-uri>
    <fr:route>/icfp-2025/</fr:route>
    <fr:title text="ICFP 2025">ICFP 2025</fr:title>
  </fr:frontmatter>
  <fr:mainmatter>
    <html:p>Two weeks ago I was fortunate enough to attend the <fr:link href="https://icfp25.sigplan.org/" type="external">International Conference on Functional Programming</fr:link> in Singapore. My first time in Asia and my second time at the conference, what follows are some thoughts and presentations I enjoyed whilst I was there.</html:p>
    <html:p>I must thank my office mate (and friend!) <fr:link href="https://ryan.freumh.org/" type="external">Ryan Gibb</fr:link> for his camaraderie and sage advice: "the best track is <html:em>hallway</html:em> track". Not to mention all of his <fr:link href="https://ryan.freumh.org/photos.html" type="external">photos</fr:link> too. Thanks Ryan!</html:p>
    <html:div style="text-align: center">
  <html:img class="inner-img" src="/bafkrmid2d6u3qdufa6m5gogavtwm6uqksaicozrc5s2unrtzjtth3hpvey.jpeg" alt="Description follows image." />
</html:div>
    <html:p>From right to left, top to bottom: <fr:link href="https://patrick.sirref.org/anil madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>, <fr:link href="https://patrick.sirref.org/sadiq jaffer/" type="external">Sadiq Jaffer</fr:link>, <fr:link href="https://patrick.sirref.org/patrick ferris/" type="external">Patrick Ferris</fr:link>, <fr:link href="https://patrick.sirref.org/ryan gibb/" type="external">Ryan Gibb</fr:link> and <fr:link href="https://patrick.sirref.org/roy ang/" type="external">Roy Ang</fr:link>.</html:p>
    <fr:tree show-metadata="false" numbered="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>10</fr:month>
          <fr:day>24</fr:day>
        </fr:date>
        <fr:title text="Random Hacking">Random Hacking</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Below are just some of the pieces of random hacking I got up to whilst in Singapore.</html:p>
        <fr:tree show-metadata="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:uri>https://patrick.sirref.org/oxcaml-and-uring/</fr:uri>
            <fr:display-uri>oxcaml-and-uring</fr:display-uri>
            <fr:route>/oxcaml-and-uring/</fr:route>
            <fr:title text="OxCaml and Uring">OxCaml and Uring</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Jane Street were a big presence at ICFP 2025, carting along with them a shiny new OCaml compiler: <fr:link href="https://oxcaml.org/" type="external">OxCaml</fr:link>. If have been <fr:link href="/try-oxcaml/" title="Try OxCaml" uri="https://patrick.sirref.org/try-oxcaml/" display-uri="try-oxcaml" type="local">playing around with OxCaml recently</fr:link> but nothing outside toplevels in Javascript. Until now!</html:p>
            <html:p>After talking to <fr:link href="/dra27/" title="David Allsopp" uri="https://patrick.sirref.org/dra27/" display-uri="dra27" type="local">David</fr:link>, I spent some time converting a small corner of the <fr:link href="https://github.com/ocaml-multicore/ocaml-uring" type="external">ocaml-uring</fr:link> library to use a part of <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link>. In particular making the following change:</html:p>
            <html:pre class="hilite">
              <html:code>
                <html:span class="ocaml-source">  </html:span>
                <html:span class="ocaml-keyword-other">module</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-keyword-operator">=</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-keyword-other">struct</html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">    </html:span>
                <html:span class="ocaml-keyword-other">type</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-source">ptr</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-keyword-operator">=</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-support-type">int32</html:span>
                <html:span class="ocaml-keyword-other">#</html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">    </html:span>
                <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                <html:span class="ocaml-comment-block"> ... </html:span>
                <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">  </html:span>
                <html:span class="ocaml-keyword-other">end</html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">  </html:span>
                <html:span class="ocaml-keyword-other">type</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-source">cqe</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-keyword-operator">=</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">    </html:span>
                <html:span class="ocaml-source">user_data_id</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                <html:span class="ocaml-source">ptr</html:span>
                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">    </html:span>
                <html:span class="ocaml-source">res</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                <html:span class="ocaml-source"> </html:span>
                <html:span class="ocaml-support-type">int32</html:span>
                <html:span class="ocaml-keyword-other">#</html:span>
                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                <html:span class="ocaml-source">
</html:span>
                <html:span class="ocaml-source">  </html:span>
                <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                <html:span class="ocaml-source">
</html:span>
              </html:code>
            </html:pre>
            <html:p>The idea being that a completion queue entry (a notification that some operation has completed) could be fully represented using 64 bits (two 32-bit, <fr:link href="https://oxcaml.org/documentation/unboxed-types/01-intro/" type="external">unboxed values</fr:link>). You can <fr:link href="https://github.com/ocaml-multicore/ocaml-uring/compare/main...patricoferris:ocaml-uring:oxcaml?expand=1" type="external">see how this impacted the library</fr:link>! I'm not certain about this change (and I'm sure I did it wrong) but it was nice to realise <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> gives you this kind of control. However, I am worried about the ergonomics of manipulating values like <html:code>int32#</html:code> and the temptation to case it into an <html:code>int</html:code> (presumably losing a good portion of the value of having an unboxed value in the first place).</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>10</fr:month>
              <fr:day>24</fr:day>
            </fr:date>
            <fr:title text="Bibtex Parser">Bibtex Parser</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>On the flight over to Singapore, I started to write a post for this website. Some readers may remember that I use <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link> after a preprocessing step via <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">graft</fr:link> to build this site. Part of that preprocessing consumes bibtex files and outputs forester trees. For the initial <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">graft</fr:link> release I used the excellent <fr:link href="https://github.com/Octachron/talaria_bibtex" type="external">Talaria Bibtex</fr:link> library. Unfortunately, it presented a pretty confusing API that, whilst nicely typed, felt a little cumbersome to use. Additionally, it was too specific in what it would accept as valid Bibtex. I wanted something that was a little more straight-forward to use (if a little fast-and-loose when it comes to types...). And so I built <fr:link href="/bib/" title="Bib" uri="https://patrick.sirref.org/bib/" display-uri="bib" type="local">bib</fr:link>.</html:p>
            <html:p>This was my first real attempt at using the <fr:link href="https://ocaml.org/p/bytesrw" type="external">Bytesrw</fr:link> library. I was happy with the results, although I did have to copy a substantial amount of code from <fr:link href="https://ocaml.org/p/jsont" type="external">other bytesrw-compatible libraries</fr:link>. I'd be happy to shift to this <html:code>bytes</html:code>-first world if it wasn't for the ever-present-in-my-mind issue of relocatable values in the OCaml heap!</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>10</fr:month>
              <fr:day>24</fr:day>
            </fr:date>
            <fr:title text="Geocaml Libraries">Geocaml Libraries</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>There has been some excellent <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">outreachy</fr:link> work happening on the <fr:link href="https://github.com/geocaml/ocaml-tiff" type="external">geocaml/ocaml-tiff</fr:link> library which is a potential Outreachy internship project for December 2025. More on this in a future post.</html:p>
            <html:p>On the way back (and a little during the conference), I spent some time building an OCaml counterpart to <fr:link href="https://github.com/ucam-eo/geotessera/" type="external">geotessera</fr:link>, a library for working with <fr:link href="/tessera2025/" title="TESSERA: Temporal Embeddings of Surface Spectra for Earth Representation and Analysis" uri="https://patrick.sirref.org/tessera2025/" display-uri="tessera2025" type="local">Tessera</fr:link>. The library is not ready for people to use directly, but I was working on various constituent parts including:</html:p>
            <html:ul>
              <html:li>
                <html:p><fr:link href="https://github.com/geocaml/ocaml-proj" type="external">Modern OCaml bindings to PROJ</fr:link> (a coordinate reference system projection library)</html:p>
              </html:li>
              <html:li>
                <html:p>
                  <fr:link href="https://github.com/geocaml/ocaml-wkt" type="external">Further work on a WKT library for OCaml</fr:link>
                </html:p>
              </html:li>
              <html:li>
                <html:p>Coming soon... ocaml-geotessera</html:p>
              </html:li>
            </html:ul>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" numbered="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>10</fr:month>
          <fr:day>24</fr:day>
        </fr:date>
        <fr:title text="Talks">Talks</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>10</fr:month>
              <fr:day>24</fr:day>
            </fr:date>
            <fr:title text="Hazel of OCaml at TyDe">Hazel of OCaml at TyDe</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>The <html:em>type-driven development</html:em> (TyDe) workshop was held on the first day of ICFP at the <fr:link href="https://www.comp.nus.edu.sg/" type="external">NUS School of Computing</fr:link>. I find the workshop name to be a little misleading, but perhaps this comes from my engineering background. The talks focused a lot on type <html:em>theory</html:em>, presenting the formal mathematics of interesting type systems with less focus on <html:em>why</html:em> it might be useful to have such an exotic type system... but then again, that was the nature of the entire conference.</html:p>
            <html:p>I presented a talk on <fr:link href="/hazel-of-ocaml/" title="A Transpiler from OCaml to Hazel" uri="https://patrick.sirref.org/hazel-of-ocaml/" display-uri="hazel-of-ocaml" type="local">hazel_of_ocaml</fr:link>. The <fr:link href="https://patrick.sirref.org/var/tyde2025.pdf" type="external">slides are here</fr:link>, along with the <fr:link href="https://patrick.sirref.org/var/tyde2025-ea.pdf" type="external">extended abstract</fr:link>. My talk ended up focusing a lot on the pedagogical benefits of having a type system that helped explain the most important thing a type system does... catch type errors! This work represents a small piece of work inside <fr:link href="https://maxcarroll0.github.io/" type="external">Max Carroll's</fr:link> excellent <fr:link href="/part-ii-hazel/" title="Type Error Debugging in Hazel" uri="https://patrick.sirref.org/part-ii-hazel/" display-uri="part-ii-hazel" type="local">part II</fr:link> project, which he presented at the <fr:link href="https://maxcarroll0.github.io/papers/workshops/HATRA-decomposable-type-highlighting/" type="external">HATRA workshop</fr:link>: <html:em>Decomposable Type Highlighting for Bidirectional Type and Cast Systems</html:em>.</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>10</fr:month>
              <fr:day>24</fr:day>
            </fr:date>
            <fr:title text="Scientific Programming at PROPL">Scientific Programming at PROPL</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>I think it is important to be honest whenever you get a talk accepted that you otherwise feel should not have been. My talk "<html:em>about scientific programming what we talk about when we talk</html:em>" is one such talk. The <fr:link href="https://patrick.sirref.org/var/propl2025.pdf" type="external">slides are here</fr:link>. The talk itself was nothing to write home about, but I think there were a few nice ideas that came out of it and the conversations I had with fellow PROPL attenders.</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>10</fr:month>
                  <fr:day>24</fr:day>
                </fr:date>
                <fr:title text="TMF Data Discrepancies Redux">TMF Data Discrepancies Redux</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>On the eve of my talk, I decided to re-run some analysis I did a few years ago on the <fr:link href="https://forobs.jrc.ec.europa.eu/TMF/data#downloads" type="external">tropical moist forest dataset</fr:link>, knowing that since then a few more years had become available. After fighting with some bit-rot in the Google Earth Engine script I had used, the new results were not very uplifting.</html:p>
                <html:table>
    <html:tbody>
    <html:tr>
    <html:td><html:strong>Land Use Class</html:strong></html:td>
    <html:td><html:strong>Percent Change</html:strong></html:td>
    </html:tr>
    <html:tr>
    <html:td>Undisturbed</html:td>
    <html:td> -2.9</html:td>
    </html:tr>
    <html:tr>
    <html:td>Degraded</html:td>
    <html:td> -5.5</html:td>
    </html:tr>
    <html:tr style="background: yellow">
    <html:td>Deforested</html:td>
    <html:td> 8.6</html:td>
    </html:tr>
    <html:tr>
    <html:td>Regrowth</html:td>
    <html:td> 0.5</html:td>
    </html:tr>
    <html:tr>
    <html:td>Water</html:td>
    <html:td> 0.0</html:td>
    </html:tr>
    <html:tr>
    <html:td>Other</html:td>
    <html:td>-0.6</html:td>
    </html:tr>
    </html:tbody>
</html:table>
                <html:p>The data in the table corresponds to the land use class values in Indonesia in the year 2008. The analysis computed the difference across each of the classes between the dataset released in 2021 and the dataset released in 2024. Most notably, the amount of deforested land has gone up by <html:em>8.6</html:em> percent!</html:p>
                <html:p>As a somewhat tangential, though related, aside, I had the pleasure of talking to <fr:link href="https://cs.nyu.edu/~shw8119/" type="external">Sam Westrick</fr:link>, <fr:link href="https://forthoney.github.io/" type="external">Seong-Heon Jung</fr:link> and <fr:link href="https://svishnus.github.io/" type="external">Sundara Vishnu Satish</fr:link> of the <fr:link href="https://nyu-parcour.github.io/" type="external">ParCour</fr:link> research group. They were telling me about <fr:link href="https://github.com/mpllang/mpl" type="external">MaPLe</fr:link>, a programming language from the MLs built for parallelism. We discussed some ideas of using real-world, geospatial algorithms as benchmarks for MaPLe. <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link>, if you got this far remind me to chat to you about this!</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>10</fr:month>
                  <fr:day>24</fr:day>
                </fr:date>
                <fr:title text="Shelter Reactions">Shelter Reactions</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>At the end of my talk, I briefly mentioned <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">shelter</fr:link>. By far, this was the topic I got the most engagement on post-talk. During the conference, this was also true when people asked what I was working on. The tag line "a shell with <html:em>undo</html:em>" seemed to capture the attention of most people.</html:p>
                <html:p>I'm feeling a renewed sense of interest in my own work thanks to that, even if the "research" contributions are not very apparent. However, I also had a good discussion with <fr:link href="https://kcsrk.info/" type="external">KC</fr:link> about the underlying <fr:link href="https://patrick.sirref.org/mrdt/" type="external">MRDT</fr:link> in <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> and how we might think about collaborating in the future on MRDT-related work.</html:p>
                <html:p>Related to that, I managed to spend the evening in <fr:link href="https://www.openstreetmap.org/relation/18195609#map=16/1.28090/103.84222" type="external">Chinatown</fr:link> with <fr:link href="https://dynamicaspects.org/research/" type="external">Roly Perera</fr:link>. Roly's work has focused on <fr:link href="https://f.luid.org/" type="external">Fluid</fr:link>, a transparency-based programming language that allows authors to reveal their computation to their user. Excitingly, Roly presented a <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/propl-2025-papers/10/Authoring-Tools-for-Transparent-Climate-Reporting" type="external">new text-based part of the language</fr:link> at PROPL. Our work is in the same universe, loosely orbiting some notion of reproducibility and explainability, but quite different in engineering work and how users might actually interact with our systems. I thoroughly enjoyed talking about solutions or research ideas that <html:em>preserve</html:em> existing workflows. Roly was great at pulling that out of the current work I have been doing.</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" numbered="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2025</fr:year>
          <fr:month>10</fr:month>
          <fr:day>24</fr:day>
        </fr:date>
        <fr:title text="Other Talks and Highlights">Other Talks and Highlights</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>I was a part of, often in a very small way, some other talks that were presented at ICFP including</html:p>
        <html:ul>
          <html:li>
            <html:p><fr:link href="https://www.youtube.com/watch?v=j84ocjlj1JA&amp;amp;t=12880s" type="external">Functional Networking for Docker</fr:link>, I encourage you to read <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil's</fr:link> <fr:link href="https://anil.recoil.org/notes/icfp25-ocaml5-js-docker#functional-networking-at-docker" type="external">notes on the topic</fr:link>. It is also worth mentioning <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil's</fr:link> <fr:link href="https://anil.recoil.org/notes/icfp25-post-posix" type="external">post-posix talk</fr:link> (not unrelated to my Uring musings above).</html:p>
          </html:li>
          <html:li>
            <html:p><fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link> gave an excellent, <html:em>very live</html:em>, talk about <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/propl-2025-papers/6/Yirgacheffe-a-declarative-approach-to-geospatial-data" type="external">Yirgacheffe</fr:link> at PROPL which I thoroughly enjoyed. I'm also excited about his recent developments which I'm sure you can clue into <fr:link href="https://digitalflapjack.com/weeknotes/" type="external">over on his blog</fr:link>.</html:p>
          </html:li>
        </html:ul>
        <html:p>Below is a non-exhaustive list of talks I enjoyed whilst at the conference. Some relevant, most of them not!</html:p>
        <html:ul>
          <html:li>
            <html:p>By far, one of the best talks was <fr:link href="https://icfp25.sigplan.org/details/icfp-2025-papers/13/Polynomial-Time-Program-Equivalence-for-Machine-Knitting" type="external">Polynomial-time Program Equivalence for Machine Knitting</fr:link>. I think the talk really nailed the "here's the idea, the details are in the paper"-presenting style as they described an "...algorithm that canonicalizes the algebraic representations of the topological semantics of machine knitting programs".</html:p>
          </html:li>
          <html:li>
            <html:p>I attended most of the <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/icfp-splash-2025-tutorials/5/A-guided-tour-through-Oxidized-OCaml" type="external">OxCaml tutorial</fr:link> presented by the incredibly friendly <fr:link href="https://gavinleroy.com/" type="external">Gavin Gray</fr:link>.</html:p>
          </html:li>
          <html:li>
            <html:p><fr:link href="/ryangibb/" title="Ryan Gibb" uri="https://patrick.sirref.org/ryangibb/" display-uri="ryangibb" type="local">Ryan</fr:link>'s talk <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/propl-2025-papers/13/Spatial-Programming-for-Environmental-Monitoring" type="external">Spatial Programming for Environmental Monitoring</fr:link> at PROPL was excellent.</html:p>
          </html:li>
        </html:ul>
        <html:p>There's plenty more to talk about, and I'm sure my future posts will reference other parts of my experience at ICFP 2025. Thanks for reading, and if anybody is interested in any aspects of this do reach out!</html:p>
      </fr:mainmatter>
    </fr:tree>
  </fr:mainmatter>
  <fr:backmatter>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="References">References</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Zhengpeng Feng/" type="external">Zhengpeng Feng</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Clement Atzberger/" type="external">Clement Atzberger</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Sadiq Jaffer/" type="external">Sadiq Jaffer</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Jovana Knezevic/" type="external">Jovana Knezevic</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Silja Sormunen/" type="external">Silja Sormunen</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Robin Young/" type="external">Robin Young</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Madeline C. Lisaius" type="external">Madeline C. Lisaius</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Markus Immitzer/" type="external">Markus Immitzer</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/David A. Coomes" type="external">David A. Coomes</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Andrew Blake/" type="external">Andrew Blake</fr:link>
              </fr:author>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Srinivasan Keshav/" type="external">Srinivasan Keshav</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/tessera2025/</fr:uri>
            <fr:display-uri>tessera2025</fr:display-uri>
            <fr:route>/tessera2025/</fr:route>
            <fr:title text="TESSERA: Temporal Embeddings of Surface Spectra for Earth Representation and Analysis">TESSERA: Temporal Embeddings of Surface Spectra for Earth Representation and Analysis</fr:title>
            <fr:taxon>Reference</fr:taxon>
            <fr:meta name="external">http://arxiv.org/abs/2506.20380</fr:meta>
            <fr:meta name="doi">10.48550/arXiv.2506.20380</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <fr:tree show-metadata="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Zhengpeng Feng/" type="external">Zhengpeng Feng</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Clement Atzberger/" type="external">Clement Atzberger</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Sadiq Jaffer/" type="external">Sadiq Jaffer</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Jovana Knezevic/" type="external">Jovana Knezevic</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Silja Sormunen/" type="external">Silja Sormunen</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Robin Young/" type="external">Robin Young</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Madeline C. Lisaius" type="external">Madeline C. Lisaius</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Markus Immitzer/" type="external">Markus Immitzer</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/David A. Coomes" type="external">David A. Coomes</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Andrew Blake/" type="external">Andrew Blake</fr:link>
                  </fr:author>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Srinivasan Keshav/" type="external">Srinivasan Keshav</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                </fr:date>
                <fr:title text="Abstract">Abstract</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>
	Petabytes of satellite Earth Observation (EO) data are freely available and can address critical global challenges. However, EO data quality is poor due to clouds and variable lighting conditions. To address this, practitioners typically use compositing, but this critically removes the temporal phenological signal. Moreover, supervised machine learning to map composited pixels to task-specific classes requires accurately labelled data that are rarely available. We present TESSERA, a pixel-oriented foundation model for EO time series that creates 128-dimensional latent embeddings requiring only a few labels for task-specific training to achieve state-of-the-art performance across diverse complex tasks. TESSERA uses two encoders that combine optical data with synthetic aperture radar backscatter coefficients at 10m resolution, creating embeddings fused with a multilayer perceptron to generate annual global embedding maps. TESSERA closely matches or outperforms state-of-the-art task-specific models and other foundation models across five diverse downstream tasks. It is unprecedented in ease of use, scale, and accuracy: no other open foundation model provides precomputed outputs with global, annual coverage at 10m resolution. 
</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Context">Context</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/posts/</fr:uri>
            <fr:display-uri>posts</fr:display-uri>
            <fr:route>/posts/</fr:route>
            <fr:title text="Posts">Posts</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Occasionally I write posts, mostly about OCaml or something related.</html:p>
            <html:p><fr:link href="/posts/atom.xml" type="external">An RSS feed is available</fr:link>.</html:p>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2026</fr:year>
                  <fr:month>6</fr:month>
                  <fr:day>17</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/a-shell-is-born/</fr:uri>
                <fr:display-uri>a-shell-is-born</fr:display-uri>
                <fr:route>/a-shell-is-born/</fr:route>
                <fr:title text="A Shell is Born">A Shell is Born</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> passed a milestone this week after installing the following packages <html:code>vim fakeroot fakechroot debootstrap</html:code> and successfully performing a <fr:link href="https://wiki.debian.org/fakechroot" type="external">fakechroot debootstrap</fr:link>.</html:p>
                <html:p>To me, this signals that <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> is closer than ever to being an <html:em>actual</html:em> POSIX-ish shell. This is exciting because we now have a completely customisable, OCaml implementation of a shell that can run a significant number of existing shell scripts in the world. Let the hacking commence!</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>6</fr:month>
                      <fr:day>17</fr:day>
                    </fr:date>
                    <fr:title text="Installation">Installation</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>You can install the binary, <html:code>msh</html:code>, today:</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="sh-source">opam pin git+https://git.sirref.org/merry
</html:span>
                        <html:span class="sh-support-function-builtin">eval</html:span>
                        <html:span class="sh-source"> </html:span>
                        <html:span class="sh-punctuation-definition-string-begin"><![CDATA[$(]]></html:span>
                        <html:span class="sh-string-interpolated-dollar">opam env</html:span>
                        <html:span class="sh-punctuation-definition-string-end"><![CDATA[)]]></html:span>
                        <html:span class="sh-source">
</html:span>
                        <html:span class="sh-source">msh
</html:span>
                      </html:code>
                    </html:pre>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>6</fr:month>
                      <fr:day>17</fr:day>
                    </fr:date>
                    <fr:title text="What's next?">What's next?</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>There are a few avenues to try next. In the short-term, more testing of the shell is probably worthwhile. In particular, trying to boot an Alpine Linux image with <html:code>msh</html:code> as the default shell would be good.</html:p>
                    <html:p>Integrating the various components of <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> is also on the list. A time-travelling POSIX shell is within reach; the actual semantics still need to be ironed out.</html:p>
                    <html:p>I know for certain that some shell options and built-ins will be the first issues to arise going forward.</html:p>
                    <html:p>As a fun experiment, <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil</fr:link>'s vibecoded <fr:link href="https://tangled.org/anil.recoil.org/ocaml-bbox" type="external">OCaml busybox translation</fr:link> could be plumbed into <html:code>msh</html:code>. This would allow a very versatile, but <html:em>zero-forking</html:em> shell! Throw in an in-memory Eio filesystem into the mix and the whole thing becomes in-memory... <fr:link href="https://mirage.io/" type="external"><html:code>mirageSH</html:code></fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>6</fr:month>
                      <fr:day>17</fr:day>
                    </fr:date>
                    <fr:title text="Weeknotes">Weeknotes</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Below are a collection of weeknotes for <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>.</html:p>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>7</fr:month>
                          <fr:day>4</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w26/</fr:uri>
                        <fr:display-uri>weekly-2026-w26</fr:display-uri>
                        <fr:route>/weekly-2026-w26/</fr:route>
                        <fr:title text="Shell Benchmarks, Back to Writing">Shell Benchmarks, Back to Writing</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>A little late due to travel, but I did a little benchmarking of <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>7</fr:month>
                              <fr:day>4</fr:day>
                            </fr:date>
                            <fr:title text="Signal Handling in Merry">Signal Handling in Merry</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>In order to even run <fr:link href="https://github.com/shellspec/shellbench" type="external">shellbench</fr:link>, I first had to fix some bugs in the shell implementation. Shellbench aims to warm up the shell before starting any benchmarks; it includes this prelude before getting started:</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="sh-source">__ready=
</html:span>
                                <html:span class="sh-support-function-builtin">trap</html:span>
                                <html:span class="sh-source"> __ready=1 HUP
</html:span>
                                <html:span class="sh-support-function-builtin">kill</html:span>
                                <html:span class="sh-source"> -HUP </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">MAIN_PID</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-keyword-control">until</html:span>
                                <html:span class="sh-meta-scope-while-loop"><![CDATA[ []]></html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">__ready</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-meta-scope-while-loop"><![CDATA[ ]]]></html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-while-loop"> </html:span>
                                <html:span class="sh-keyword-control">do</html:span>
                                <html:span class="sh-meta-scope-while-loop"> __dummy=</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-while-loop"> </html:span>
                                <html:span class="sh-keyword-control">done</html:span>
                                <html:span class="sh-source">
</html:span>
                              </html:code>
                            </html:pre>
                            <html:p>Whilst writing <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>, I hadn't really considered that the return context from a trap needed to be taken into consideration! I had assumed they would be silently ignored, how else would we know where to thread that context back into the shell's execution.</html:p>
                            <html:p>Even after reading through the specification for <fr:link href="https://pubs.opengroup.org/onlinepubs/009604599/utilities/trap.html" type="external">trap</fr:link> I am still none the wiser. I've opted to place some sensible signal polling points during the execution of the commands to run any signals that have come in. The single handlers in <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> simply push thunks onto a run queue. Looking at the Dash source code, it <fr:link href="https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/eval.c#n230" type="external">seems to be something that happens just before evaluation</fr:link>.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>7</fr:month>
                              <fr:day>4</fr:day>
                            </fr:date>
                            <fr:title text="Benchmarking Merry">Benchmarking Merry</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>7</fr:month>
                                  <fr:day>4</fr:day>
                                </fr:date>
                                <fr:title text="Medium-to-small potatoes">Medium-to-small potatoes</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>I used <fr:link href="https://github.com/shellspec/shellbench" type="external">shellbench</fr:link> to understand where some of the performance pitfalls were coming from.</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-source">$ ./shellbench -s bash,zsh,msh sample/func.sh
</html:span>
                                    <html:span class="sh-source">-----------------------------------------------------------------------------------
</html:span>
                                    <html:span class="sh-source">name                                                     bash        zsh        msh
</html:span>
                                    <html:span class="sh-source">-----------------------------------------------------------------------------------
</html:span>
                                    <html:span class="sh-source">func.sh: no func                                      775,539  1,124,485      5,229
</html:span>
                                    <html:span class="sh-source">func.sh: func                                         398,861    197,169     93,424
</html:span>
                                    <html:span class="sh-source">-----------------------------------------------------------------------------------
</html:span>
                                    <html:span class="sh-keyword-operator-glob">*</html:span>
                                    <html:span class="sh-source"> count: number of executions per second
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>This particular benchmark first runs nothing (i.e. <html:code>:</html:code>) and then a function lookup and execution. Surprisingly <html:code>msh</html:code> is <html:em>slower</html:em> at doing <html:em>nothing</html:em>! I <html:code>perf</html:code>-ed a run of <html:code>msh test.sh</html:code> with just a single <html:code>:</html:code> in the file:</html:p>
                                <html:iframe width="100%|" height="400px" src="/bafkrmicucn54u6lmz2u3jky3sug4nxj7yhwjf3iscpfcax7ar4fwjl7gce.svg" />
                                <fr:tree show-metadata="false" numbered="false">
                                  <fr:frontmatter>
                                    <fr:authors>
                                      <fr:author>
                                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                      </fr:author>
                                    </fr:authors>
                                    <fr:date>
                                      <fr:year>2026</fr:year>
                                      <fr:month>7</fr:month>
                                      <fr:day>4</fr:day>
                                    </fr:date>
                                    <fr:title text="Test built-in">Test built-in</fr:title>
                                  </fr:frontmatter>
                                  <fr:mainmatter>
                                    <html:p>After making various improvements to <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> that almost halved the memory usage (e.g., removing extraneous string manipulations, adding a fast-path to the <html:code>PATH</html:code> variable for resolving programs). I was still pretty far off the performance of these other shells. I decided to have a look at <html:code>dash</html:code> which has a simple implementation.</html:p>
                                    <html:iframe width="100%|" height="400px" src="/bafkrmieljhv7prkf5rovr72f22v44fdizrszrmtn46feydg6phek2sac7a.svg" />
                                    <html:p>This flame graph is for the following shell script:</html:p>
                                    <html:pre class="hilite">
                                      <html:code>
                                        <html:span class="sh-entity-name-function">f</html:span>
                                        <html:span class="sh-meta-function"> </html:span>
                                        <html:span class="sh-punctuation-definition-arguments"><![CDATA[()]]></html:span>
                                        <html:span class="sh-meta-function"> </html:span>
                                        <html:span class="sh-punctuation-definition-group"><![CDATA[{]]></html:span>
                                        <html:span class="sh-meta-scope-group"> </html:span>
                                        <html:span class="sh-support-function-builtin">:</html:span>
                                        <html:span class="sh-keyword-operator-list">;</html:span>
                                        <html:span class="sh-meta-scope-group"> </html:span>
                                        <html:span class="sh-punctuation-definition-group"><![CDATA[}]]></html:span>
                                        <html:span class="sh-punctuation-definition-function">
</html:span>
                                        <html:span class="sh-keyword-control">while</html:span>
                                        <html:span class="sh-meta-scope-while-loop"> __count=</html:span>
                                        <html:span class="sh-punctuation-definition-string-begin"><![CDATA[$((]]></html:span>
                                        <html:span class="sh-punctuation-definition-variable">$</html:span>
                                        <html:span class="sh-variable-other-normal">__count</html:span>
                                        <html:span class="sh-keyword-operator-arithmetic">+</html:span>
                                        <html:span class="sh-constant-numeric-integer">1</html:span>
                                        <html:span class="sh-punctuation-definition-string-end"><![CDATA[))]]></html:span>
                                        <html:span class="sh-meta-scope-while-loop"> </html:span>
                                        <html:span class="sh-keyword-operator-list">&amp;&amp;</html:span>
                                        <html:span class="sh-meta-scope-while-loop"><![CDATA[ []]></html:span>
                                        <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                        <html:span class="sh-punctuation-definition-variable">$</html:span>
                                        <html:span class="sh-variable-other-normal">__count</html:span>
                                        <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                        <html:span class="sh-meta-scope-while-loop"><![CDATA[ -le 10000 ]]]></html:span>
                                        <html:span class="sh-keyword-operator-list">;</html:span>
                                        <html:span class="sh-meta-scope-while-loop"> </html:span>
                                        <html:span class="sh-keyword-control">do</html:span>
                                        <html:span class="sh-meta-scope-while-loop">
</html:span>
                                        <html:span class="sh-meta-scope-while-loop">	f
</html:span>
                                        <html:span class="sh-keyword-control">done</html:span>
                                        <html:span class="sh-source">
</html:span>
                                        <html:span class="sh-support-function-builtin">echo</html:span>
                                        <html:span class="sh-source"> </html:span>
                                        <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                        <html:span class="sh-string-quoted-double">count is </html:span>
                                        <html:span class="sh-punctuation-definition-variable">$</html:span>
                                        <html:span class="sh-variable-other-normal">__count</html:span>
                                        <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                        <html:span class="sh-source">
</html:span>
                                      </html:code>
                                    </html:pre>
                                    <html:p>And here are some rudimentary benchmarks:</html:p>
                                    <html:pre class="hilite">
                                      <html:code>
                                        <html:span class="sh-source">$ </html:span>
                                        <html:span class="sh-keyword-other">time</html:span>
                                        <html:span class="sh-source"> -p dash test.sh
</html:span>
                                        <html:span class="sh-source">count is 10001
</html:span>
                                        <html:span class="sh-source">real 0.01
</html:span>
                                        <html:span class="sh-source">user 0.01
</html:span>
                                        <html:span class="sh-source">sys 0.00
</html:span>
                                        <html:span class="sh-source">$ </html:span>
                                        <html:span class="sh-keyword-other">time</html:span>
                                        <html:span class="sh-source"> -p msh test.sh
</html:span>
                                        <html:span class="sh-source">count is 10001
</html:span>
                                        <html:span class="sh-source">real 15.53
</html:span>
                                        <html:span class="sh-source">user 4.28
</html:span>
                                        <html:span class="sh-source">sys 12.28
</html:span>
                                      </html:code>
                                    </html:pre>
                                    <html:p>It turns out the massive slowdown is very simple to explain. In the <html:code>dash</html:code> flamegraph there is a <html:code>oexpr</html:code> stack; <fr:link href="https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/bltin/test.c" type="external">which comes from the bltin/test.c</fr:link> file. <html:code>dash</html:code>, along with the other shells, does <html:em>not</html:em> spawn a process for the <html:code><![CDATA[[]]></html:code>-test command! Forcing <html:code>dash</html:code> to do use the binary <html:code><![CDATA[[]]></html:code> gives:</html:p>
                                    <html:pre class="hilite">
                                      <html:code>
                                        <html:span class="sh-source">$ </html:span>
                                        <html:span class="sh-keyword-other">time</html:span>
                                        <html:span class="sh-source"> -p dash test.sh
</html:span>
                                        <html:span class="sh-source">count is 10001
</html:span>
                                        <html:span class="sh-source">real 7.55
</html:span>
                                        <html:span class="sh-source">user 3.95
</html:span>
                                        <html:span class="sh-source">sys 3.44
</html:span>
                                      </html:code>
                                    </html:pre>
                                    <html:p>Which is much more respectable in terms of performance compared to <html:code>msh</html:code>. Plenty of work to do though!</html:p>
                                  </fr:mainmatter>
                                </fr:tree>
                                <fr:tree show-metadata="false" numbered="false">
                                  <fr:frontmatter>
                                    <fr:authors>
                                      <fr:author>
                                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                      </fr:author>
                                    </fr:authors>
                                    <fr:date>
                                      <fr:year>2026</fr:year>
                                      <fr:month>7</fr:month>
                                      <fr:day>4</fr:day>
                                    </fr:date>
                                    <fr:title text="Parsing arithmetic expressions">Parsing arithmetic expressions</fr:title>
                                  </fr:frontmatter>
                                  <fr:mainmatter>
                                    <html:p>There was some obvious low-hanging fruit to help improve some of the performance differences. The first was pre-parsing arithmetic expressions. <fr:link href="github.com/colis-anr/morbig" type="external">Morbig</fr:link>, the static parser, does not implement arithmetic expression parsing; so <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> does it for us. Before, it was on-demand, as we encountered an expression of the form <html:code>$((&lt;e&gt;))</html:code>. Now, it happens up front. This should improve tight-loops.</html:p>
                                  </fr:mainmatter>
                                </fr:tree>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>7</fr:month>
                              <fr:day>4</fr:day>
                            </fr:date>
                            <fr:title text="Writing">Writing</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>More on this soon, but I have started writing two separate papers bringing all of this work together.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>6</fr:month>
                          <fr:day>16</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w25/</fr:uri>
                        <fr:display-uri>weekly-2026-w25</fr:display-uri>
                        <fr:route>/weekly-2026-w25/</fr:route>
                        <fr:title text="Three weeks in the Shell">Three weeks in the Shell</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>The last three weeks have been focused work on building <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>. In practice, I wanted to run the following two commands through <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>'s shell: <html:code>msh</html:code>:</html:p>
                        <html:pre><![CDATA[apt-get install debootstrap -y
debootstrap stable /stable-chroot http://deb.debian.org/debian/]]></html:pre>
                        <html:p>Seemingly innocuous. But both commands run <html:em>thousands</html:em> of lines of shell script. Whether that's <fr:link href="https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html" type="external">Debian package maintainer scripts</fr:link> or <fr:link href="https://salsa.debian.org/installer-team/debootstrap/-/blob/master/functions?ref_type=heads#L623" type="external">state-machines for processing package release files</fr:link>.</html:p>
                        <html:p>What follows is a handful of the bugs and the shell scripts that caused them.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>6</fr:month>
                              <fr:day>16</fr:day>
                            </fr:date>
                            <fr:title text="Field Splitting">Field Splitting</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>Edge-cases abound in the <fr:link href="/posixSpec/" title="IEEE/Open Group Standard for Information Technology--Portable Operating System Interface (POSIX™) Base Specifications, Issue 8" uri="https://patrick.sirref.org/posixSpec/" display-uri="posixSpec" type="local">POSIX shell specification</fr:link>; and field splitting is one of the most serious perpetrators. <html:em>Field splitting</html:em> happens after <html:em>word expansion</html:em>. It is a known footgun amongst shell script authors.</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="sh-source">$ count </html:span>
                                <html:span class="sh-punctuation-definition-subshell"><![CDATA[(]]></html:span>
                                <html:span class="sh-punctuation-definition-subshell"><![CDATA[)]]></html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-group"><![CDATA[{]]></html:span>
                                <html:span class="sh-meta-scope-group"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-meta-scope-group"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">Count: </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-special">#</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-group"> </html:span>
                                <html:span class="sh-punctuation-definition-group"><![CDATA[}]]></html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">hello world</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> count </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-source">Count: 2
</html:span>
                              </html:code>
                            </html:pre>
                            <html:p>Quoting variables that need expanding will prevent field splitting from taking place, but it is an easy thing to forget.</html:p>
                            <html:p>Field splitting uses the <html:code>IFS</html:code> (internal field separator) environment variable to determine how to do the splitting, and it comes with some extra rules beyond "split on these characters".</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="sh-source">$ IFS=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double"> </html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double"> hello    world</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-source">hello world
</html:span>
                                <html:span class="sh-source">$ IFS=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double"> </html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double"> hello    world</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-source"> hello    world
</html:span>
                                <html:span class="sh-source">$ IFS=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">:</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">a:b:c:</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-source">a b c
</html:span>
                                <html:span class="sh-source">$ IFS=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">:</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">a:b::c:d</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-source">a b  c d
</html:span>
                                <html:span class="sh-source">$ IFS=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">:</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">:a:b:c</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-source"> a b c
</html:span>
                                <html:span class="sh-source">$ IFS=</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> FOO=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">unset   IFS</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">FOO</html:span>
                                <html:span class="sh-source">
</html:span>
                                <html:span class="sh-support-function-builtin">unset</html:span>
                                <html:span class="sh-source">   IFS
</html:span>
                              </html:code>
                            </html:pre>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>6</fr:month>
                                  <fr:day>16</fr:day>
                                </fr:date>
                                <fr:title text="Variable assignment">Variable assignment</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>How a shell stores variables also impacts field splitting. Naively, <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> stored variables as strings, but really they should be stored as their expanded form.</html:p>
                                <html:p>Consider this example of saving a function output in a variable called <html:code>base</html:code>.</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-entity-name-function">iter</html:span>
                                    <html:span class="sh-meta-function"> </html:span>
                                    <html:span class="sh-punctuation-definition-arguments"><![CDATA[()]]></html:span>
                                    <html:span class="sh-meta-function"> </html:span>
                                    <html:span class="sh-punctuation-definition-group"><![CDATA[{]]></html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">a</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">b</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">c</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-punctuation-definition-group"><![CDATA[}]]></html:span>
                                    <html:span class="sh-punctuation-definition-function">
</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-source">base=</html:span>
                                    <html:span class="sh-punctuation-definition-string-begin"><![CDATA[$(]]></html:span>
                                    <html:span class="sh-string-interpolated-dollar">iter</html:span>
                                    <html:span class="sh-punctuation-definition-string-end"><![CDATA[)]]></html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-keyword-control">for</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-variable-other-loop">n</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-keyword-control">in</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-normal">base</html:span>
                                    <html:span class="sh-keyword-operator-list">;</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-keyword-control">do</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop">  </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">Got </html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-normal">n</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                    <html:span class="sh-keyword-control">done</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-keyword-control">for</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-variable-other-loop">n</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-keyword-control">in</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-normal">base</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-keyword-operator-list">;</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-keyword-control">do</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop">  </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">Got </html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-normal">n</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                    <html:span class="sh-keyword-control">done</html:span>
                                    <html:span class="sh-source">
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>Later, when we come to iterate across the fields of <html:code>$base</html:code> we wouldn't be able to reconstruct the intial fields that <html:code>$(iter)</html:code> produced if we simply saved the result as a string. Too much information would have been lost.</html:p>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>6</fr:month>
                              <fr:day>16</fr:day>
                            </fr:date>
                            <fr:title text="Redirections">Redirections</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>Redirections control what file descriptors point to. Each redirection has a lifetime associated with it. For example: <html:code>cat &lt; README.md</html:code> really says "open <html:code>README.md</html:code> and execute the <html:code>cat</html:code> program mapping the process's FD <html:code>0</html:code> to the FD of <html:code>README.md</html:code>". When <html:code>cat</html:code> returns that redirection is no longer valid.</html:p>
                            <html:p>Other redirections are not so simple. Consider:</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="sh-source">$ </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">!dlrow olleh</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-keyword-operator-redirect">&gt;</html:span>
                                <html:span class="sh-source"> input.txt
</html:span>
                                <html:span class="sh-source">$ </html:span>
                                <html:span class="sh-punctuation-definition-subshell"><![CDATA[(]]></html:span>
                                <html:span class="sh-meta-scope-subshell">read line</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-subshell"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-meta-scope-subshell"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">line</html:span>
                                <html:span class="sh-punctuation-definition-subshell"><![CDATA[)]]></html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-keyword-operator-redirect">&lt;</html:span>
                                <html:span class="sh-source"> input.txt </html:span>
                                <html:span class="sh-keyword-operator-pipe">|</html:span>
                                <html:span class="sh-source"> rev
</html:span>
                                <html:span class="sh-source">hello world</html:span>
                                <html:span class="sh-keyword-operator-pipe">!</html:span>
                                <html:span class="sh-source">
</html:span>
                              </html:code>
                            </html:pre>
                            <html:p>There are lots of redirections here too. Firstly the standard input for everything inside the braced command (<html:code>read line2; echo $line</html:code>) should be the open file descriptor for <html:code>input.txt</html:code>. The standard output of the braced command should be the writing end of a pipe whose reading end is passed to <html:code>rev</html:code> as that process's standard input. The final standard output for <html:code>rev</html:code> should be unchanged from what it was originally (the shell's standard output).</html:p>
                            <html:p>Getting redirections right is hard, consider this snippet from the debootstrap scripts (all in the context of stdout and stderr pointing to a <html:code>debootstrap.log</html:code> file and file descriptor <html:code>4</html:code> pointing at the true stdout).</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="sh-keyword-control">for</html:span>
                                <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                <html:span class="sh-variable-other-loop">m</html:span>
                                <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                <html:span class="sh-keyword-control">in</html:span>
                                <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">MIRRORS</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-for-in-loop"> </html:span>
                                <html:span class="sh-keyword-control">do</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">    pkgdest=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">TARGET</html:span>
                                <html:span class="sh-string-quoted-double">/</html:span>
                                <html:span class="sh-punctuation-definition-string-begin"><![CDATA[$(]]></html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">DLDEST</html:span>
                                <html:span class="sh-string-interpolated-dollar"> pkg </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">s</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">c</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">a</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">m</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">path</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-punctuation-definition-string-end"><![CDATA[)]]></html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                <html:span class="sh-meta-scope-if-block">    </html:span>
                                <html:span class="sh-keyword-control">if</html:span>
                                <html:span class="sh-meta-scope-if-block"><![CDATA[ []]></html:span>
                                <html:span class="sh-keyword-operator-pipe">!</html:span>
                                <html:span class="sh-meta-scope-if-block"> -e </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">pkgdest</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-meta-scope-if-block"><![CDATA[ ]]]></html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-if-block"> </html:span>
                                <html:span class="sh-keyword-control">then</html:span>
                                <html:span class="sh-meta-scope-if-block"> </html:span>
                                <html:span class="sh-keyword-control">continue</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-if-block"> </html:span>
                                <html:span class="sh-keyword-control">fi</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">    pkgs_to_get=</html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-string-begin"><![CDATA[$(]]></html:span>
                                <html:span class="sh-string-interpolated-dollar">download_debs </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">m</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">pkgdest</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">pkgs_to_get</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-keyword-operator-redirect">5&gt;&amp;1</html:span>
                                <html:span class="sh-string-interpolated-dollar"> </html:span>
                                <html:span class="sh-keyword-operator-redirect">1&gt;&amp;6</html:span>
                                <html:span class="sh-punctuation-definition-string-end"><![CDATA[)]]></html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                <html:span class="sh-meta-scope-if-block">    </html:span>
                                <html:span class="sh-keyword-control">if</html:span>
                                <html:span class="sh-meta-scope-if-block"><![CDATA[ [ -z]]></html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-punctuation-definition-variable">$</html:span>
                                <html:span class="sh-variable-other-normal">pkgs_to_get</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-meta-scope-if-block"><![CDATA[ ]]]></html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-if-block"> </html:span>
                                <html:span class="sh-keyword-control">then</html:span>
                                <html:span class="sh-meta-scope-if-block"> </html:span>
                                <html:span class="sh-support-function-builtin">break</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-if-block"> </html:span>
                                <html:span class="sh-keyword-control">fi</html:span>
                                <html:span class="sh-meta-scope-for-in-loop">
</html:span>
                                <html:span class="sh-keyword-control">done</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-keyword-operator-redirect">6&gt;&amp;1</html:span>
                                <html:span class="sh-source">
</html:span>
                              </html:code>
                            </html:pre>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>6</fr:month>
                              <fr:day>16</fr:day>
                            </fr:date>
                            <fr:title text="More niche built-ins">More niche built-ins</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>As the dust begins to settle on the nuts and bolts of implementing a POSIX-ish shell, new challenges are allowed to emerge from deep within scripts.</html:p>
                            <html:p>One such challenge is the seemingly endless (I know, they're finite) shell built-ins! Whilst trying to run <fr:link href="https://wiki.debian.org/fakechroot" type="external">debootstrap using its <html:code>fakechroot</html:code> variant</fr:link>, I bumped into <html:code>getopts</html:code>... a whole command-line parsing shell built-in.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>6</fr:month>
                              <fr:day>16</fr:day>
                            </fr:date>
                            <fr:uri>https://patrick.sirref.org/eio_mem/</fr:uri>
                            <fr:display-uri>eio_mem</fr:display-uri>
                            <fr:route>/eio_mem/</fr:route>
                            <fr:title text="An In-memory Filesystem for Eio ">An In-memory Filesystem for Eio </fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>Towards the end of last week and the beginning of this week, I threw together a prototype for an <html:em>in-memory filesystem</html:em> for <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link>: <fr:link href="https://git.sirref.org/eio_mem" type="external">Eio_mem</fr:link>. Concretely, this provides a means for constructing an <html:code>Eio.Fs.dir_ty Eio.Path.t</html:code> value that is completely in-memory.</html:p>
                            <html:p>Thanks to <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link>'s capability-first approach, any existing code implemented against the <html:code>_ Eio.Path.t</html:code> API should just work with the in-memory filesystem.</html:p>
                            <html:p>There's a convenient <html:code>Eio_mem.Fs.load</html:code> function that can take a path from one filesystem (most likely a normal one from <html:code>Eio_linux</html:code> or <html:code>Eio_posix</html:code>) and replicate it into the in-memory filesystem. For example, you might have a static web-server pointing to a directory like <html:code>"/var/www"</html:code>. The following might be the only change you need to make it completely in-memory (<fr:link href="https://github.com/mirage/ocaml-cohttp/blob/main/cohttp-eio/examples/server2.ml" type="external">example from ocaml-cohttp</fr:link>):</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="diff-source"><![CDATA[ let () =]]></html:span>
                                <html:span class="diff-source">   let port = ref 8080 in
</html:span>
                                <html:span class="diff-source">   Arg.parse
</html:span>
                                <html:span class="diff-source"><![CDATA[     [ ("-p", Arg.Set_int port, " Listening port number(8080 by default)") ]]]></html:span>
                                <html:span class="diff-source">     ignore "An HTTP/1.1 server";
</html:span>
                                <html:span class="diff-source">   Eio_main.run @@ fun env -&gt;
</html:span>
                                <html:span class="diff-punctuation-definition-inserted">+</html:span>
                                <html:span class="diff-markup-inserted">  Eio_mem.run @@ fun menv -&gt;
</html:span>
                                <html:span class="diff-source">   Eio.Switch.run @@ fun sw -&gt;
</html:span>
                                <html:span class="diff-punctuation-definition-deleted">-</html:span>
                                <html:span class="diff-markup-deleted"><![CDATA[  (* Restrict to current directory: *)]]></html:span>
                                <html:span class="diff-source">
</html:span>
                                <html:span class="diff-punctuation-definition-deleted">-</html:span>
                                <html:span class="diff-markup-deleted">  let htdocs = Eio.Stdenv.cwd env in
</html:span>
                                <html:span class="diff-punctuation-definition-inserted">+</html:span>
                                <html:span class="diff-markup-inserted"><![CDATA[  (* Restrict to in-memory current directory: *)]]></html:span>
                                <html:span class="diff-source">
</html:span>
                                <html:span class="diff-punctuation-definition-inserted">+</html:span>
                                <html:span class="diff-markup-inserted"><![CDATA[  Eio_mem.Fs.load ~filter (Eio.Stdenv.cwd env);]]></html:span>
                                <html:span class="diff-source">
</html:span>
                                <html:span class="diff-punctuation-definition-inserted">+</html:span>
                                <html:span class="diff-markup-inserted">  let htdocs = Eio.Stdenv.cwd menv in
</html:span>
                                <html:span class="diff-source">   let socket =
</html:span>
                                <html:span class="diff-source">     Eio.Net.listen env#net ~sw ~backlog:128 ~reuse_addr:true
</html:span>
                                <html:span class="diff-source"><![CDATA[       (`Tcp (Eio.Net.Ipaddr.V4.loopback, !port))]]></html:span>
                              </html:code>
                            </html:pre>
                            <html:p>The keen-eyed reader might have noticed the <html:code>filter</html:code> parameter. This can be used to ignore certain paths (here I ignored <html:code>.git</html:code> and <html:code>_build</html:code> which were adding substantial time to loading the filesystem).</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>6</fr:month>
                          <fr:day>4</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w23/</fr:uri>
                        <fr:display-uri>weekly-2026-w23</fr:display-uri>
                        <fr:route>/weekly-2026-w23/</fr:route>
                        <fr:title text="Using meio to debug Merry">Using meio to debug Merry</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>During a large rewrite of <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>, I introduced a regression causing certain shell programs to hang indefinitely. I thought it might be a good opportunity to try out <fr:link href="/meio/" title="Meio" uri="https://patrick.sirref.org/meio/" display-uri="meio" type="local">Meio</fr:link>.</html:p>
                        <html:p>First, let's look at a trace of <fr:link href="/meio/" title="Meio" uri="https://patrick.sirref.org/meio/" display-uri="meio" type="local">Meio</fr:link> from some real-world programs. For example: <html:code>meio -- msh -c "sleep 100"</html:code>.</html:p>
                        <html:img src="/bafkrmideu267e77ak6j5b7z2gda6nijipa7tfmz2r4ivsruktrhdzai3gi.gif" />
                        <html:p>One problem that comes up immediately from this example is that the tree hierarchy of tasks and cancellation contexts makes it tricky to reason about the logging. Here, we can see the pipeline's cancellation context clearly labelled <html:code>pipeline-id1</html:code>. This is an <html:code>Eio.Switch.t</html:code> for the pipeline <html:code>sleep 100</html:code>. The actual execution log for <html:code>sleep 100</html:code> bubbles back up to the main fiber (that has no name, so it is called <html:code>&lt;task&gt;</html:code>). The daemon fiber, for ensuring the spawned process is reaped, is attached to the switch and is displayed below it.</html:p>
                        <html:p><fr:link href="/meio/" title="Meio" uri="https://patrick.sirref.org/meio/" display-uri="meio" type="local">Meio</fr:link> has a long way to go. Most programs are too fast to be monitored in this way. Using something like <fr:link href="https://github.com/tokio-rs/console" type="external">tokio-console</fr:link>'s model might be a better idea here focusing less on the tree strucuture of the program, and more on the performance and monitoring of individual tasks. Without this, it turns out <fr:link href="/meio/" title="Meio" uri="https://patrick.sirref.org/meio/" display-uri="meio" type="local">Meio</fr:link> was not all that useful for debugging this specific issue (which ended up being some bad pipe management on my part).</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>4</fr:month>
                          <fr:day>28</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w17/</fr:uri>
                        <fr:display-uri>weekly-2026-w17</fr:display-uri>
                        <fr:route>/weekly-2026-w17/</fr:route>
                        <fr:title text="Shell forks revisited">Shell forks revisited</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Whilst I did get up to some other work last week, I decided to dedicate this weekly to <html:code>fork</html:code>-ing in the shell.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>4</fr:month>
                              <fr:day>28</fr:day>
                            </fr:date>
                            <fr:title text="Must we fork?">Must we fork?</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>I have spent some time trying to figure out: can you implement a shell that never has to <html:code>fork</html:code> and run its own code (as opposed to <html:code>fork+exec</html:code>-ing, which is necessary)? There are, at least, two bits of POSIX shell semantics that make this hard: concurrency and redirects, particularly in the presence of shell built-ins.</html:p>
                            <html:p>Individual commands in a pipeline, according to the <fr:link href="/posixSpec/" title="IEEE/Open Group Standard for Information Technology--Portable Operating System Interface (POSIX™) Base Specifications, Issue 8" uri="https://patrick.sirref.org/posixSpec/" display-uri="posixSpec" type="local">POSIX specification</fr:link>, will have their standard input and output connected up before other redirections.</html:p>
                            <html:blockquote>
                              <html:p>The standard input, standard output, or both of a command shall be considered to be assigned by the pipeline before any redirection specified by redirection operators that are part of the command.</html:p>
                            </html:blockquote>
                            <html:p>Additionally:</html:p>
                            <html:blockquote>
                              <html:p>...each command of a multi-command pipeline is in a subshell environment; as an extension, however, any or all commands in a pipeline may be executed in the current environment.</html:p>
                            </html:blockquote>
                            <html:p>Where a subshell is defined as:</html:p>
                            <html:blockquote>
                              <html:p>Subshell: A shell execution environment, distinguished from the main or current shell execution environment.</html:p>
                            </html:blockquote>
                            <html:p>We will note that subshell <fr:tex display="inline"><![CDATA[\neq ]]></fr:tex> child process. In practice, however, the two are used fairly interchangeably given the semantics of spawning a child process. Perhaps the two most crucial aspects of a given command in a subshell are that:</html:p>
                            <html:ol>
                              <html:li>
                                <html:p>It is run <html:em>in parallel</html:em> with the other commands.</html:p>
                              </html:li>
                              <html:li>
                                <html:p>It should be <fr:link href="https://en.wikipedia.org/wiki/Reentrancy_(computing)" type="external"><html:em>reentrant</html:em></fr:link>.</html:p>
                              </html:li>
                            </html:ol>
                            <html:p>In what follows we will assume that we are discussing a multi-command pipeline <fr:tex display="inline"><![CDATA[p]]></fr:tex>.</html:p>
                            <html:p>
                              <fr:tex display="block"><![CDATA[ \texttt {p} =  \texttt {cmd}_1 | ... | \texttt {cmd}_n \text { where } n \geq  2 ]]></fr:tex>
                            </html:p>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>4</fr:month>
                                  <fr:day>28</fr:day>
                                </fr:date>
                                <fr:title text="Pipeline parallelism">Pipeline parallelism</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>The <fr:link href="/posixSpec/" title="IEEE/Open Group Standard for Information Technology--Portable Operating System Interface (POSIX™) Base Specifications, Issue 8" uri="https://patrick.sirref.org/posixSpec/" display-uri="posixSpec" type="local">POSIX specification</fr:link> does not mandate parallelism explicitly for commands in a pipeline. However, in practice the semantics of a pipeline necessitate concurrency at the very least.</html:p>
                                <html:p>Suppose we have <fr:tex display="inline"><![CDATA[\texttt {cmd}_1 | \texttt {cmd}_2]]></fr:tex> where <fr:tex display="inline"><![CDATA[\texttt {cmd}_1]]></fr:tex> produces an infinite amount of output (e.g., <html:code>cat /dev/urandom</html:code>) and <fr:tex display="inline"><![CDATA[\texttt {cmd}_2]]></fr:tex> consumes a finite amount of input (e.g., <fr:link href="https://github.com/dinosaure/hxd" type="external"><html:code>hxd-xxd -l100</html:code></fr:link>). What is the result of running this pipeline with the default POSIX shell options?</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-source">$ dash -c </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">cat /dev/urandom | hxd.xxd -l100</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-source">00000000: 5033 7981 ae44 d475 074c 5361 0a9e 3828  P3y..D.u.LSa..8</html:span>
                                    <html:span class="sh-punctuation-definition-subshell"><![CDATA[(]]></html:span>
                                    <html:span class="sh-meta-scope-subshell">
</html:span>
                                    <html:span class="sh-meta-scope-subshell">00000010: f88c 1f9e 3b0e bcde 528a f78c b1e4 7195  ....</html:span>
                                    <html:span class="sh-keyword-operator-list">;</html:span>
                                    <html:span class="sh-meta-scope-subshell">...R.....q.
</html:span>
                                    <html:span class="sh-meta-scope-subshell"><![CDATA[00000020: 16f2 8325 c90b 9310 539c af04 8289 c3a0  ...%....S.......]]></html:span>
                                    <html:span class="sh-meta-scope-subshell">
</html:span>
                                    <html:span class="sh-meta-scope-subshell">00000030: 57c5 680a 2c81 a999 71b6 708e 95df e720  W.h.,...q.p....
</html:span>
                                    <html:span class="sh-meta-scope-subshell">00000040: 004c 407a 8365 9448 65c6 b435 bed2 4084  .L@z.e.He..5..@.
</html:span>
                                    <html:span class="sh-meta-scope-subshell">00000050: 62ea 96ab 2b23 0385 f9d2 fc30 d090 1719  b...+#.....0....
</html:span>
                                    <html:span class="sh-meta-scope-subshell">00000060: 68d1 c514                                h...
</html:span>
                                    <html:span class="sh-meta-scope-subshell">cat: write error: Broken pipe
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>There are three factors that influence the pipeline's execution behaviour (i.e. what is done about the commands that are run and the exit status we return).</html:p>
                                <html:ol>
                                  <html:li>
                                    <html:p><html:code>pipefail</html:code>: With <html:code>pipefail</html:code> set to <html:code>false</html:code> (the default), the exit status of the pipeline is entirely decided upon by the exit status of the <html:em>rightmost</html:em> command (above <fr:tex display="inline"><![CDATA[\texttt {cmd}_2]]></fr:tex>). With <html:code>pipefail</html:code>, the pipe will exit with 0 if all commands exit with 0; otherwise the non-zero exit status of the <html:em>rightmost</html:em> command is taken.</html:p>
                                  </html:li>
                                  <html:li>
                                    <html:p><html:code>!</html:code>: If the pipeline begins with <html:code>!</html:code> then this inverts the exit code in the way you might expect.</html:p>
                                  </html:li>
                                  <html:li>
                                    <html:p>All commands must terminate.</html:p>
                                  </html:li>
                                </html:ol>
                                <html:p>Whilst in theory <fr:tex display="inline"><![CDATA[\texttt {cmd}_1]]></fr:tex> does not terminate, the termination of <fr:tex display="inline"><![CDATA[\texttt {cmd}_2]]></fr:tex> closes the reading end of the pipe resulting in the <html:code>Broken pipe</html:code> system error.</html:p>
                                <html:p>Let's replace <fr:tex display="inline"><![CDATA[\texttt {cmd}_1]]></fr:tex> with the following <html:em>compound command</html:em> that also produces, left to its own devices, infinite output on <html:code>stdout</html:code>.</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-keyword-control">while</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">some bytes</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-keyword-operator-list">;</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-keyword-control">do</html:span>
                                    <html:span class="sh-meta-scope-while-loop">
</html:span>
                                    <html:span class="sh-meta-scope-while-loop">  </html:span>
                                    <html:span class="sh-support-function-builtin">:</html:span>
                                    <html:span class="sh-meta-scope-while-loop">
</html:span>
                                    <html:span class="sh-keyword-control">done</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-keyword-operator-pipe">|</html:span>
                                    <html:span class="sh-source"> hxd.xxd -l100
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>In this example, we no longer have the luxury of being able to <html:code>fork</html:code> and <html:code>exec</html:code>. The compound command (the <html:code>while</html:code> loop) forces our hand -- we must rely on the internal execution logic of the shell to keep it going. How then do we prevent <fr:tex display="inline"><![CDATA[\texttt {cmd}_1]]></fr:tex> from blocking our shell from spawning <fr:tex display="inline"><![CDATA[\texttt {cmd}_2]]></fr:tex>?</html:p>
                                <html:p>For most shells, this is where they might <html:code>fork</html:code> themselves and allow the <html:code>while</html:code> loop to execute in the child. The parent continuing on. Alternatively, the work could continue on in a separate thread (in OCaml parlance, domain). Fibers (green threads, coroutines etc.) are only possible if there are a sufficient number of co-operative yields (which can be hard to track: any control flow or shell built-in would need to ensure they periodically yield to the other commands in the pipeline).</html:p>
                                <html:p>With that being said, it would seem we have workarounds to ensure the parallel aspects of pipelines are possible to build without forking the shell state itself.</html:p>
                              </fr:mainmatter>
                            </fr:tree>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>4</fr:month>
                                  <fr:day>28</fr:day>
                                </fr:date>
                                <fr:title text="Command Reentrancy">Command Reentrancy</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>Command reentrancy deals with the fact that commands in a pipeline run in <html:em>subshells</html:em>. In practice, this means any <fr:tex display="inline"><![CDATA[\texttt {cmd}_i]]></fr:tex> should not impact the <html:em>execution environment</html:em> of any other <fr:tex display="inline"><![CDATA[\texttt {cmd}_j]]></fr:tex>. Commands may certainly interfere with one another: a rogue <html:code>rm</html:code> might remove a file that some other command was about to read or was in the middle of reading!</html:p>
                                <html:p><fr:tex display="inline"><![CDATA[\S 2.13]]></fr:tex> of the POSIX shell specification describes the execution environment. In <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> we lift this into the <html:code>ctx</html:code> type making it completely immutable; the only way to update the context is to destructively declare new fields, e.g., <html:code><![CDATA[{ ctx with cwd = "/home/bactrian" }]]></html:code>. All shell built-ins work directly from the context as opposed to any state that might <html:em>also</html:em> be kept by the process itself (e.g., we do not call <html:code>getcwd(3)</html:code> to expand <html:code>PWD</html:code>, but instead read it from the context).</html:p>
                                <html:p>Most state is handled nicely by this <html:em>functional</html:em> implementation of the shell; except open (or not) file descriptors. The <html:code>exec</html:code> built-in is particularly thorny in this regard:</html:p>
                                <html:blockquote>
                                  <html:p>If exec is specified with no operands, any redirections associated with the exec command shall be made in the current shell execution environment.</html:p>
                                </html:blockquote>
                                <html:p>So, <html:code>exec 3&gt;&amp;1</html:code> says "in the current execution environment map file descriptor <html:code>3</html:code> to <html:code>stdout</html:code>" and <html:code>exec &gt; /dev/null</html:code> says "in the current execution environment map <html:code>stdout</html:code> to <html:code>/dev/null</html:code>. This is often used to silence anything writing to <html:code>stdout</html:code>.</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-entity-name-function">info</html:span>
                                    <html:span class="sh-meta-function"> </html:span>
                                    <html:span class="sh-punctuation-definition-arguments"><![CDATA[()]]></html:span>
                                    <html:span class="sh-meta-function"> </html:span>
                                    <html:span class="sh-punctuation-definition-group"><![CDATA[{]]></html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-meta-scope-group">  </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">INFO: </html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-positional">1</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">&gt;&amp;3</html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-punctuation-definition-group"><![CDATA[}]]></html:span>
                                    <html:span class="sh-punctuation-definition-function">
</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-support-function-builtin">exec</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">3&gt;&amp;1</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">&gt;</html:span>
                                    <html:span class="sh-source"> /dev/null
</html:span>
                                    <html:span class="sh-source">info </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">Starting up server...</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">Some noisy program spamming STDOUT</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-source">info </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">All is quiet...</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-source">
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>If we are not running shell built-ins inside new child processes, then we must lift the file descriptor table into the context as well and <html:em>disallow</html:em> any two built-ins to run in parallel. Consider this example:</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-support-function-builtin">exec</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">&lt;</html:span>
                                    <html:span class="sh-source"> ./hello.txt
</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-keyword-control">while</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-support-function-builtin">read</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> line</html:span>
                                    <html:span class="sh-keyword-operator-list">;</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-keyword-control">do</html:span>
                                    <html:span class="sh-meta-scope-while-loop">
</html:span>
                                    <html:span class="sh-meta-scope-while-loop">  </html:span>
                                    <html:span class="sh-support-function-builtin">echo</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">Got </html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-normal">line</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-while-loop"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">&gt;&amp;2</html:span>
                                    <html:span class="sh-meta-scope-while-loop">
</html:span>
                                    <html:span class="sh-keyword-control">done</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-keyword-operator-pipe">|</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-punctuation-definition-subshell"><![CDATA[(]]></html:span>
                                    <html:span class="sh-meta-scope-subshell">exec </html:span>
                                    <html:span class="sh-keyword-operator-redirect">&lt;</html:span>
                                    <html:span class="sh-meta-scope-subshell"> ./world.txt</html:span>
                                    <html:span class="sh-keyword-operator-list">;</html:span>
                                    <html:span class="sh-meta-scope-subshell"> cat</html:span>
                                    <html:span class="sh-punctuation-definition-subshell"><![CDATA[)]]></html:span>
                                    <html:span class="sh-source">
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>If we allow <html:code>exec</html:code> to <html:em>change</html:em> the set of open file descriptors of the shell process directly, then individual commands in the pipeline are no longer re-entrant. The pipeline here is not being used to pipe bytes from one command to another, but instead to expose concurrency and the subshell behaviour.</html:p>
                                <html:p>The second <html:code>exec &lt; ./world.txt</html:code> has no impact on the currently opened file on <html:code>stdin</html:code>, the while loop continues to read <html:code>./hello.txt</html:code>. This is straightforward to implement with <html:code>fork</html:code> as you can <html:code>dup2</html:code> any files you need. The bookkeeping and isolation is all provided by the POSIX process semantics. Without <html:code>fork</html:code>, the file descriptors would have to be saved and restored on every suspension and resumption to provide an illusion of isolation.</html:p>
                                <html:p>We could relax our rule to "disallow any two built-ins to run in parallel" by taking a lock on the file descriptor table, but considering the lock is held from the point of resumption until the next suspension it might not achieve very much in practice.</html:p>
                                <html:p>Some of the intricacies of scheduling are also covered in <fr:link href="/greenberg2020smoosh/" title="Executable formal semantics for the POSIX shell" uri="https://patrick.sirref.org/greenberg2020smoosh/" display-uri="greenberg2020smoosh" type="local">Michael Greenberg's <html:em>An executable and formal semantics of the POSIX shell</html:em></fr:link>.</html:p>
                                <html:blockquote>
                                  <html:p>To motivate the question, consider the following two pipelines:</html:p>
                                  <html:p>(1) <html:code>while true; do echo 5; done | true</html:code></html:p>
                                  <html:p>(2) <html:code><![CDATA[while true; do echo 5; done | { read x; echo $((x+42)); }]]></html:code></html:p>
                                  <html:p>Both pipelines spawn two processes, both of which use shell builtins exclusively: neither of these pipelines needs to make an <html:code>execve</html:code> system call (though some systems may implement true or echo as executables, Smoosh and most shells build them in).</html:p>
                                </html:blockquote>
                                <html:p>Scheduling is an opaque part of the <fr:link href="/posixSpec/" title="IEEE/Open Group Standard for Information Technology--Portable Operating System Interface (POSIX™) Base Specifications, Issue 8" uri="https://patrick.sirref.org/posixSpec/" display-uri="posixSpec" type="local">POSIX specification</fr:link>. Indeed, as we have argued here, there is <html:em>no</html:em> semantics for scheduling. Here is a similar pipeline run through a script that <html:code>strace</html:code>s for <html:code>clone</html:code> and <html:code>fork</html:code> calls on various shells:</html:p>
                                <html:pre><![CDATA[% ./test/check_fork.sh "while echo 5; do : ; done | true"
bash  3
dash  3
yash  1 
zsh   1
ksh   1
ash   3]]></html:pre>
                                <html:p>It might make an interesting use case for effects in OCaml -- whilst we can certainly piggyback on <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link>'s existing suspension mechanisms, this is slightly different in that we need to ensure some preconditions are true before resuming certain computations. Fiber-local state is insufficient as programs implicitly depend on global state of the process (in particular the FD table). In this sense, we need some form of suspension-resumption hooks.</html:p>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>4</fr:month>
                          <fr:day>3</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w14/</fr:uri>
                        <fr:display-uri>weekly-2026-w14</fr:display-uri>
                        <fr:route>/weekly-2026-w14/</fr:route>
                        <fr:title text="Forking in Shells &amp; Library Maintenance">Forking in Shells &amp; Library Maintenance</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>This week, <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> got close to executing <html:code>apt-get install ca-certificates</html:code> and running Debian's <html:code>debootstrap</html:code> scripts correctly. <fr:link href="https://patrick.sirref.org/nathan/" type="external">Nathan</fr:link> and I released <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> <html:code>0.38.0</html:code>, I added support to <fr:link href="https://github.com/geocaml/ocaml-proj" type="external">ocaml-proj</fr:link> for compiling to the browser and I fixed a long-standing bug in <fr:link href="https://github.com/patricoferris/hilite" type="external">hilite</fr:link>.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>4</fr:month>
                              <fr:day>3</fr:day>
                            </fr:date>
                            <fr:title text="Forking in Merry">Forking in Merry</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>So far, <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> has managed to support many features of the POSIX shell specification without needing to do a <html:code>fork(2)</html:code> without an <html:code>exec</html:code>. Or, to put it another way, all the forking that <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> does, will only be followed by running C code. This is actually a feature of <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link>'s <html:code>Process</html:code> API. It is required to make process execution safe in the context of multiple domains in OCaml (mostly due to ensuring consistency within the garbage collector). However, it is perfectly okay to <html:code>fork</html:code> and run OCaml code provided there is only a single domain.</html:p>
                            <html:p>In a shell, many features of the shell language require that commands (or built-ins, function applications etc.) execute within a <html:code>subshell</html:code>. The specification does not go into detail about how shells should implement this, but many choose to <html:code>fork</html:code> in order to preserve some state in the parent (for example, the file descriptor table). Some shells try to minimise the number of forks as an optimisation. The <fr:link href="/korn1996korn/" title="The New Korn Shell" uri="https://patrick.sirref.org/korn1996korn/" display-uri="korn1996korn" type="local">korn shell (ksh)</fr:link> is one such shell.</html:p>
                            <html:blockquote>
                              <html:p>Using the notation <html:code>$(command)</html:code> will cause <html:code>command</html:code> to execute in a subshell of the current ksh. In many instances, ksh will not actually fork/exec a subshell when command is a built-in or a shell function.</html:p>
                            </html:blockquote>
                            <html:p>By trying to adhere to Multicore OCaml's "<html:em>thou shalt not fork</html:em>" commandment, <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> is much more similar to <html:code>ksh</html:code> in this regard. However, whenever there is an interaction with a shell built-in and semantics that need a child process, things get tricky very quickly. Consider the following:</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="sh-keyword-control">while</html:span>
                                <html:span class="sh-meta-scope-while-loop"> </html:span>
                                <html:span class="sh-support-function-builtin">echo</html:span>
                                <html:span class="sh-meta-scope-while-loop"> </html:span>
                                <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                <html:span class="sh-string-quoted-double">hello</html:span>
                                <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                <html:span class="sh-keyword-operator-list">;</html:span>
                                <html:span class="sh-meta-scope-while-loop"> </html:span>
                                <html:span class="sh-keyword-control">do</html:span>
                                <html:span class="sh-meta-scope-while-loop">
</html:span>
                                <html:span class="sh-meta-scope-while-loop">  </html:span>
                                <html:span class="sh-support-function-builtin">:</html:span>
                                <html:span class="sh-meta-scope-while-loop">
</html:span>
                                <html:span class="sh-keyword-control">done</html:span>
                                <html:span class="sh-source"> </html:span>
                                <html:span class="sh-keyword-operator-pipe">|</html:span>
                                <html:span class="sh-source"> head -n 3
</html:span>
                              </html:code>
                            </html:pre>
                            <html:p>We have a mix of shell built-ins, normal commands, a compound command (the <html:code>while</html:code> loop) and a pipeline. Each individual command in the pipeline requires you to run them in a subshell and set them up <html:em>before</html:em> executing them. Without a <html:code>fork</html:code> for that first command, you may end up looping forever which is not the intended behaviour here. I had a good conversation with <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link> about the implications of this for reproducibility.</html:p>
                            <html:p>For now, I have started implementing a <html:code>fork</html:code> for some of the shell features whilst still trying to maintain the functional core of the implementation.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>4</fr:month>
                              <fr:day>3</fr:day>
                            </fr:date>
                            <fr:title text="An OCaml 5.5 compatible Ppxlib">An OCaml 5.5 compatible Ppxlib</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p><fr:link href="/nathanreb/" title="Nathan Rebours" uri="https://patrick.sirref.org/nathanreb/" display-uri="nathanreb" type="local">Nathan</fr:link> and I released an OCaml 5.5 compatible version of <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>.</html:p>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>3</fr:month>
                                  <fr:day>30</fr:day>
                                </fr:date>
                                <fr:uri>https://patrick.sirref.org/ppxlib-release-0-38-0/</fr:uri>
                                <fr:display-uri>ppxlib-release-0-38-0</fr:display-uri>
                                <fr:route>/ppxlib-release-0-38-0/</fr:route>
                                <fr:title text="Ppxlib Releases › 0.38.0 "><fr:link href="/ppxlib-releases/" title="Ppxlib Releases" uri="https://patrick.sirref.org/ppxlib-releases/" display-uri="ppxlib-releases" type="local">Ppxlib Releases</fr:link> › 0.38.0 </fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p><fr:link href="/nathanreb/" title="Nathan Rebours" uri="https://patrick.sirref.org/nathanreb/" display-uri="nathanreb" type="local">Nathan</fr:link> and I <fr:link href="https://github.com/ocaml/opam-repository/pull/29563" type="external">released ppxlib.0.38.0</fr:link> last week. Its main feature is full <html:em>migration</html:em> support for the upcoming OCaml 5.5 compiler (currently in its <html:code>alpha3</html:code> release). This means supporting the handful of new features landing in OCaml 5.5: <fr:link href="/modular-explicits/" title="Modular Explicits in OCaml" uri="https://patrick.sirref.org/modular-explicits/" display-uri="modular-explicits" type="local">modular explicits</fr:link>, external type declarations and arbitrary "local" structure items.</html:p>
                                <html:p>As <fr:link href="https://patrick.sirref.org/nathenreb/" type="external">Nathan</fr:link> and I continue to find a plausible maintenance story for <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>, <fr:link href="https://patrick.sirref.org/nathenreb/" type="external">Nathan</fr:link> has opened <fr:link href="https://github.com/ocaml/ocaml/issues/14668" type="external">an issue on the OCaml compiler to discuss the idea of adding additional extension points to the language</fr:link>.</html:p>
                                <html:p>This comes from the desire to be able to store encoded versions of new OCaml features inside older abstract syntax trees.</html:p>
                                <html:p>There are also some nice bug fixes in there too:</html:p>
                                <html:ul>
                                  <html:li>
                                    <html:p><fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/613" type="external">A potential OOM</fr:link> loop has now been removed.</html:p>
                                  </html:li>
                                  <html:li>
                                    <html:p>
                                      <fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/619" type="external">Locations have been restored to long identifiers!</fr:link>
                                    </html:p>
                                  </html:li>
                                </html:ul>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>4</fr:month>
                              <fr:day>3</fr:day>
                            </fr:date>
                            <fr:uri>https://patrick.sirref.org/ocaml-proj-virt/</fr:uri>
                            <fr:display-uri>ocaml-proj-virt</fr:display-uri>
                            <fr:route>/ocaml-proj-virt/</fr:route>
                            <fr:title text="Browser support for ocaml-proj ">Browser support for ocaml-proj </fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>A while ago <fr:link href="https://github.com/geocaml/ocaml-proj" type="external">I built some "modern" bindings to PROJ4 in OCaml</fr:link>. After reading <fr:link href="https://patrick.sirref.org/jonludlam/" type="external">Jon Ludlam</fr:link>'s <fr:link href="https://jon.recoil.org/blog/2026/03/weeknotes-2026-12.html" type="external">weeknotes</fr:link> (and speaking with him and <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil</fr:link>, I thought it might be nice to add a Javascript backend to those bindings). This was relatively straight-forward using <fr:link href="https://dune.readthedocs.io/en/stable/virtual-libraries.html" type="external">Dune's virtual libraries</fr:link> and is <fr:link href="https://github.com/geocaml/ocaml-proj/blob/main/src/js/proj.ml" type="external">available on Github</fr:link>.</html:p>
                            <html:p>With virtual libraries, your own data analysis could (if you wished) depend solely on the <html:code>proj</html:code> library and later choose to either link it with <html:code>proj.c</html:code> or <html:code>proj.js</html:code> depending on where the analysis is being deployed.</html:p>
                            <html:p>I briefly looked at WASM support, but quickly realised there was not much appetite for it and trying to compile around the C FFI was going to be hard.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>4</fr:month>
                              <fr:day>3</fr:day>
                            </fr:date>
                            <fr:title text="Hilite updates">Hilite updates</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>Since I helped <fr:link href="https://ocaml.org/" type="external">relaunch the ocaml.org</fr:link> website a few years ago, I have maintained <fr:link href="https://github.com/patricoferris/hilite" type="external">hilite</fr:link>, a tool for doing build-time syntax highligting.</html:p>
                            <html:p>It is being used on the <fr:link href="https://ocaml.org/" type="external">ocaml.org</fr:link> website, <fr:link href="https://github.com/xhtmlboi/yocaml/blob/45858f4b25730149dae3735e7fcdb9111ac1f9eb/yocaml_markdown.opam#L18" type="external">in yocaml_markdown</fr:link> and also in <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael's</fr:link> <fr:link href="https://github.com/mdales/webplats/blob/cf0ea95a66bae52f02a00739eb02564fc94183ee/webplats.opam#L19" type="external">webplats</fr:link> (when it works...).</html:p>
                            <html:p>And it was <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link> who led me to finally fixing and adding syntax highlighting support for Python and Go. Once I was on this roll, I finally took a look at fixing the long-standing bug of trying to highlight ocaml-mdx code, like the following:</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="ocaml-mdx-hash">#</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-float">50.123</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-mdx-hash">#</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-string-quoted-double">"</html:span>
                                <html:span class="ocaml-string-quoted-double">file.ml</html:span>
                                <html:span class="ocaml-string-quoted-double">"</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-source">
</html:span>
                              </html:code>
                            </html:pre>
                            <html:p>In fact, this code now highlights fine, but was the source of the bug. The syntax highlighting grammer confuses the ocaml-mdx <html:code>#</html:code> as a toplevel directive and trouble ensues.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>3</fr:month>
                          <fr:day>30</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w13/</fr:uri>
                        <fr:display-uri>weekly-2026-w13</fr:display-uri>
                        <fr:route>/weekly-2026-w13/</fr:route>
                        <fr:title text="Ppxlib release and Merry updates">Ppxlib release and Merry updates</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>3</fr:month>
                              <fr:day>30</fr:day>
                            </fr:date>
                            <fr:uri>https://patrick.sirref.org/ppxlib-release-0-38-0/</fr:uri>
                            <fr:display-uri>ppxlib-release-0-38-0</fr:display-uri>
                            <fr:route>/ppxlib-release-0-38-0/</fr:route>
                            <fr:title text="Ppxlib Releases › 0.38.0 "><fr:link href="/ppxlib-releases/" title="Ppxlib Releases" uri="https://patrick.sirref.org/ppxlib-releases/" display-uri="ppxlib-releases" type="local">Ppxlib Releases</fr:link> › 0.38.0 </fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p><fr:link href="/nathanreb/" title="Nathan Rebours" uri="https://patrick.sirref.org/nathanreb/" display-uri="nathanreb" type="local">Nathan</fr:link> and I <fr:link href="https://github.com/ocaml/opam-repository/pull/29563" type="external">released ppxlib.0.38.0</fr:link> last week. Its main feature is full <html:em>migration</html:em> support for the upcoming OCaml 5.5 compiler (currently in its <html:code>alpha3</html:code> release). This means supporting the handful of new features landing in OCaml 5.5: <fr:link href="/modular-explicits/" title="Modular Explicits in OCaml" uri="https://patrick.sirref.org/modular-explicits/" display-uri="modular-explicits" type="local">modular explicits</fr:link>, external type declarations and arbitrary "local" structure items.</html:p>
                            <html:p>As <fr:link href="https://patrick.sirref.org/nathenreb/" type="external">Nathan</fr:link> and I continue to find a plausible maintenance story for <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>, <fr:link href="https://patrick.sirref.org/nathenreb/" type="external">Nathan</fr:link> has opened <fr:link href="https://github.com/ocaml/ocaml/issues/14668" type="external">an issue on the OCaml compiler to discuss the idea of adding additional extension points to the language</fr:link>.</html:p>
                            <html:p>This comes from the desire to be able to store encoded versions of new OCaml features inside older abstract syntax trees.</html:p>
                            <html:p>There are also some nice bug fixes in there too:</html:p>
                            <html:ul>
                              <html:li>
                                <html:p><fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/613" type="external">A potential OOM</fr:link> loop has now been removed.</html:p>
                              </html:li>
                              <html:li>
                                <html:p>
                                  <fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/619" type="external">Locations have been restored to long identifiers!</fr:link>
                                </html:p>
                              </html:li>
                            </html:ul>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>3</fr:month>
                              <fr:day>30</fr:day>
                            </fr:date>
                            <fr:title text="Merry updates">Merry updates</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>It turns out writing a POSIX(ish) shell is hard; at least, there is a vast number of slightly obscure features that one needs to support. I think this is surprising because most people writing shell scripts write simple shell scripts; scripts that use a much smaller subset of features. In the same breath, those same developers are likely to use something like <html:code>apt-get install bash</html:code> which runs a plethora of more advanced (and non-POSIX) shell scripts!</html:p>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>3</fr:month>
                                  <fr:day>30</fr:day>
                                </fr:date>
                                <fr:title text="Exec redirects">Exec redirects</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>In a shell script, you can use the built-in command <html:code>exec</html:code> to replace the current process with a new one (e.g. <html:code>exec vim</html:code>). However, there is a <fr:link href="https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_21" type="external"><html:em>different</html:em> mode of operation</fr:link> for <html:code>exec</html:code>:</html:p>
                                <html:blockquote>
                                  <html:p>If exec is specified with no operands, any redirections associated with the exec command shall be made in the current shell execution environment.</html:p>
                                </html:blockquote>
                                <html:p>One of my litmus tests for <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> is the <fr:link href="https://wiki.debian.org/Debootstrap" type="external">Debian debootstrap scripts</fr:link> (h/t <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil</fr:link>). One thing that it does is the following:</html:p>
                                <html:pre class="hilite">
                                  <html:code>
                                    <html:span class="sh-entity-name-function">err</html:span>
                                    <html:span class="sh-meta-function"> </html:span>
                                    <html:span class="sh-punctuation-definition-arguments"><![CDATA[()]]></html:span>
                                    <html:span class="sh-meta-function"> </html:span>
                                    <html:span class="sh-punctuation-definition-group"><![CDATA[{]]></html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-meta-scope-group">  </html:span>
                                    <html:span class="sh-support-function-builtin">printf</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-punctuation-definition-string-begin">"</html:span>
                                    <html:span class="sh-string-quoted-double">err </html:span>
                                    <html:span class="sh-punctuation-definition-variable">$</html:span>
                                    <html:span class="sh-variable-other-positional">1</html:span>
                                    <html:span class="sh-punctuation-definition-string-end">"</html:span>
                                    <html:span class="sh-meta-scope-group"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">&gt;&amp;4</html:span>
                                    <html:span class="sh-meta-scope-group">
</html:span>
                                    <html:span class="sh-punctuation-definition-group"><![CDATA[}]]></html:span>
                                    <html:span class="sh-punctuation-definition-function">
</html:span>
                                    <html:span class="sh-source">
</html:span>
                                    <html:span class="sh-support-function-builtin">exec</html:span>
                                    <html:span class="sh-source"> </html:span>
                                    <html:span class="sh-keyword-operator-redirect">4&gt;&amp;1</html:span>
                                    <html:span class="sh-source"> 
</html:span>
                                  </html:code>
                                </html:pre>
                                <html:p>A lot of detail has been elided for clarity. <html:code>exec 4&gt;&amp;1</html:code> sets up a redirection for the shell's execution environment in which file descriptor <html:code>4</html:code> is now an alias for standard output. So, writing to <html:code>4</html:code> (by redirecting a command's standard output to <html:code>4</html:code> i.e. <html:code>&gt;&amp;4</html:code>) will output to where standard output is going (most likely the terminal).</html:p>
                                <html:p>For this to work, shell's must <fr:link href="https://www.man7.org/linux/man-pages/man2/dup.2.html" type="external"><html:code>dup2</html:code></fr:link> the relevant file descriptors which have the following condition:</html:p>
                                <html:blockquote>
                                  <html:p>If the file descriptor newfd was previously open, it is closed before being reused; the close is performed silently (i.e., any errors during the close are not reported by dup2()).</html:p>
                                </html:blockquote>
                                <html:p>This is all very well, unless your program has an important file already open that happens to have file descriptor <html:code>4</html:code>. The <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> Linux and POSIX backends suffer from this problem. Both make use of a file-based synchronisation mechanism for waking up the eventloop should another domain push a completion to the scheduler's run queue. On Linux this is <fr:link href="https://github.com/ocaml-multicore/eio/blob/c44ee5ce96c120b7ccc23a12d241dc8672e2888f/lib_eio_linux/sched.ml#L501" type="external">via an eventfd</fr:link> and in <fr:link href="https://github.com/ocaml-multicore/eio/blob/c44ee5ce96c120b7ccc23a12d241dc8672e2888f/lib_eio_posix/sched.ml#L20" type="external">POSIX, a pipe</fr:link>.</html:p>
                                <html:p>This <html:code>dup2</html:code> will close the <html:code>eventfd</html:code> and will likely grind Eio to a halt (or an <html:code>assert false</html:code>). For now, I have resorted to vendoring <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> and moving the <html:code>eventfd</html:code> file descriptors to higher values, though I <fr:link href="https://github.com/ocaml-multicore/eio/pull/836" type="external">have opened a PR to make this more configurable</fr:link>. This bug is quite easy to write up... it was not so easy to find!</html:p>
                                <html:p>As a random example, consider the <html:code>debconf/confmodule</html:code> <fr:link href="https://sources.debian.org/src/debconf/1.5.77/confmodule/" type="external">script</fr:link> which offers very little room for a buggy implementation!</html:p>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>3</fr:month>
                              <fr:day>30</fr:day>
                            </fr:date>
                            <fr:title text="Outreachy">Outreachy</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>The presentations from the demonstrations for this round of Outreachy are now online!</html:p>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>2</fr:month>
                                  <fr:day>9</fr:day>
                                </fr:date>
                                <fr:uri>https://patrick.sirref.org/outreachy-ocaml-tiff/</fr:uri>
                                <fr:display-uri>outreachy-ocaml-tiff</fr:display-uri>
                                <fr:route>/outreachy-ocaml-tiff/</fr:route>
                                <fr:title text="Write support in OCaml TIFF library">Write support in OCaml TIFF library</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>I am mentoring <fr:link href="/tambe-salome/" title="Tambe Salome" uri="https://patrick.sirref.org/tambe-salome/" display-uri="tambe-salome" type="local">Tambe Salome</fr:link> during the December 2025 Outreachy round to add support for writing TIFF files in the <fr:link href="/ocaml-tiff/" title="ocaml-tiff" uri="https://patrick.sirref.org/ocaml-tiff/" display-uri="ocaml-tiff" type="local">ocaml-tiff</fr:link> library.</html:p>
                                <html:p>You can now see the video of the demonstration day presentation:</html:p>
                                <html:div style="text-align: center">
<html:iframe title="Outreachy Demo Day December 2025 Round" width="560" height="315" src="https://watch.ocaml.org/videos/embed/8aUqMhFvhQGq4WJLH3ukjA?start=1h18m33s" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" />
</html:div>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2026</fr:year>
                          <fr:month>3</fr:month>
                          <fr:day>19</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2026-w12/</fr:uri>
                        <fr:display-uri>weekly-2026-w12</fr:display-uri>
                        <fr:route>/weekly-2026-w12/</fr:route>
                        <fr:title text="A POSIX Shell in OCaml">A POSIX Shell in OCaml</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Long time, no weekly. Since the start of this year I have been building a POSIX shell in OCaml called <html:code>msh</html:code> (with the underlying library called <html:code>Merry</html:code>). <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> is available online now.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>3</fr:month>
                              <fr:day>19</fr:day>
                            </fr:date>
                            <fr:title text="A POSIX(ish) shell in OCaml">A POSIX(ish) shell in OCaml</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p><fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> is a POSIX(ish) in OCaml. It uses  <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> alongside <fr:link href="github.com/colis-anr/morbig" type="external">Morbig</fr:link> (a static parser for POSIX shell).</html:p>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>3</fr:month>
                                  <fr:day>19</fr:day>
                                </fr:date>
                                <fr:title text="Why another (POSIX) shell?">Why another (POSIX) shell?</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>Shells have been around for a long time. In my research on the notion of <html:em>metashell</html:em> I wrote about Louis Pouzin originally coining the term:</html:p>
                                <fr:tree show-metadata="false" numbered="false">
                                  <fr:frontmatter>
                                    <fr:authors>
                                      <fr:author>
                                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                      </fr:author>
                                    </fr:authors>
                                    <fr:date>
                                      <fr:year>2025</fr:year>
                                      <fr:month>5</fr:month>
                                      <fr:day>19</fr:day>
                                    </fr:date>
                                    <fr:uri>https://patrick.sirref.org/pouzin-shell/</fr:uri>
                                    <fr:display-uri>pouzin-shell</fr:display-uri>
                                    <fr:route>/pouzin-shell/</fr:route>
                                    <fr:title text="Metashells › Louis Pouzin's &quot;SHELL&quot; "><fr:link href="/weekly-2025-05-12/" title="Metashells" uri="https://patrick.sirref.org/weekly-2025-05-12/" display-uri="weekly-2025-05-12" type="local">Metashells</fr:link> › Louis Pouzin's "SHELL" </fr:title>
                                  </fr:frontmatter>
                                  <fr:mainmatter>
                                    <html:p>I spent some time reading <fr:link href="/pouzin-shell-2013/" title="The Origin of the Shell" uri="https://patrick.sirref.org/pouzin-shell-2013/" display-uri="pouzin-shell-2013" type="local">part of the multics design documentation</fr:link> this week. Louis Pouzin coined the term "SHELL" in this document, and I was reminded yet again just how important it is to be a good writer even as a "computer science researcher". For example, this excerpt from the requirements section of the document</html:p>
                                    <html:blockquote>
                                      <html:p>The previous definitions imply that a command MUST be designed while keeping in mind the user, sitting at his console, wondering about what might be going on, mistyping or forgetting arguments, even if fully aware of the conventions, and possibly interfering with the command by hasty quits, carriage returns, and other temperamental reactions.</html:p>
                                    </html:blockquote>
                                    <html:p>And then later, when defining the "SHELL".</html:p>
                                    <html:blockquote>
                                      <html:p>We may envision a common procedure called automatically by the supervisor whenever a user types in some message at his console, at a time when he has no other process in active execution under console control (presently called command level). This procedure acts as an interface between console messages and subroutine. The purpose of such a procedure is to create a medium of exchange into which one could activate any procedure, <html:em>inside of another program if it were called</html:em>. Hereafter, for simplification, we shall refer to that procedure as the "SHELL".</html:p>
                                    </html:blockquote>
                                    <html:p>It still surprises how little the undergraduate degree in computer science at <fr:link href="/ucam/" title="University of Cambridge" uri="https://patrick.sirref.org/ucam/" display-uri="ucam" type="local">Cambridge</fr:link> focuses on writing skills.</html:p>
                                  </fr:mainmatter>
                                </fr:tree>
                                <html:p>I built <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> exploring the idea of a shell-like interface that allowed users to <html:em>undo</html:em> their shell actions (amongst other cool tricks). Unfortunately <html:em>shell-like</html:em> is not enough. <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> cut many corners to masquerade as a shell (e.g. appending <html:code>env</html:code> to understand how a command may have altered the execution environment). I felt it was necessary to make <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> a "SHELL"! To do that, I needed a solid foundation to build on.</html:p>
                                <html:p><html:code>msh</html:code>, the POSIX shell that comes with <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>, is by no means POSIX-complete in terms of features. But it is my <fr:link href="https://github.com/patricoferris/nixos/blob/e0faf870f76710d4a75ace775f333c88f1321c5a/modules/default.nix#L59" type="external">daily driver at this point</fr:link>. It includes a pure OCaml rewrite of <fr:link href="github.com/antirez/linenoise" type="external">linenoise</fr:link> (a small, self-contained alternative to the venerable <html:code>readline</html:code>) called <fr:link href="https://tangled.org/patrick.sirref.org/bruit" type="external">bruit</fr:link>.</html:p>
                                <html:p>If you have <html:code>docker</html:code> installed on your machine, you can take it for a spin today:</html:p>
                                <html:pre><![CDATA[docker run -it --rm patrickferris/msh]]></html:pre>
                                <html:p>The <html:code>patrickferris/msh</html:code> docker image is just for trying it out. It is based on the OCaml 5.3 alpine image.</html:p>
                                <html:p>Alternatively, you can build <html:code>msh</html:code> from source and have it available in your opam switch.</html:p>
                                <html:pre><![CDATA[opam pin git+https://tangled.org/patrick.sirref.org/merry]]></html:pre>
                                <html:p>There are many small paper cuts left to patch over, but most of it is porcelain (e.g. <html:code>ctrl+left-arrow</html:code> for moving in <fr:link href="https://tangled.org/patrick.sirref.org/bruit" type="external">bruit</fr:link>). Unfortunately, these are the kinds of things that you will <html:em>immediately</html:em> stumble upon.</html:p>
                              </fr:mainmatter>
                            </fr:tree>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>3</fr:month>
                                  <fr:day>19</fr:day>
                                </fr:date>
                                <fr:title text="What makes Merry different?">What makes Merry different?</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>Nothing.</html:p>
                                <html:p><fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> is supposed to be a solid, POSIX-ish base to build on. Unfortunaltely, as it turns out, the subset of features from the POSIX specification that people <html:em>actually use</html:em>... is pretty much all of it. Every possible redirection, variable expansion, shell built-in and compound command make some appearance. Not to mention the non-POSIX bits of shell we all take for granted (e.g. <html:code>&amp;&gt;</html:code>-redirection).</html:p>
                                <html:p><fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> and <html:code>msh</html:code> are useable. You will most likely find bugs if you use them. If, when using <html:code>msh</html:code>, you find something obscure happening you can enable debug mode either my setting the variable <html:code>MSH_DEBUG</html:code> or by invoking <html:code>msh</html:code> with <html:code>-v -v</html:code>.</html:p>
                              </fr:mainmatter>
                            </fr:tree>
                            <fr:tree show-metadata="false" numbered="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2026</fr:year>
                                  <fr:month>3</fr:month>
                                  <fr:day>19</fr:day>
                                </fr:date>
                                <fr:title text="What's next?">What's next?</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>It is soon time to combine <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> and <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> into the time-travelling, POSIX-ish shell that I have been trying to build since I first started working on <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link>.</html:p>
                                <html:p>For this to be successful, I need <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link> to be able to pass plenty of tests and right now that involves trying to install plenty of packages using tools like <html:code>apk</html:code> and <html:code>apt</html:code>.</html:p>
                                <fr:tree show-metadata="false" numbered="false">
                                  <fr:frontmatter>
                                    <fr:authors>
                                      <fr:author>
                                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                      </fr:author>
                                    </fr:authors>
                                    <fr:date>
                                      <fr:year>2026</fr:year>
                                      <fr:month>3</fr:month>
                                      <fr:day>19</fr:day>
                                    </fr:date>
                                    <fr:title text="Shell MRDT">Shell MRDT</fr:title>
                                  </fr:frontmatter>
                                  <fr:mainmatter>
                                    <html:p>What I am particularly interested in reasoning about, is the <fr:link href="https://tangled.org/patrick.sirref.org/merry/blob/main/src/lib/eval.ml#L22" type="external">execution context</fr:link> in <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>. This value, alongside the file-system, constitutes a fairly deep understanding of the state that changes in each step of a shell's evaluation loop.</html:p>
                                    <html:p>This was, in terms of <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link>, the missing piece for truly building some kind of <fr:link href="/mrdts/" title="Mergeable Replicated Data Type Implementation" uri="https://patrick.sirref.org/mrdts/" display-uri="mrdts" type="local">MRDT</fr:link> across shell sessions.</html:p>
                                  </fr:mainmatter>
                                </fr:tree>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2026</fr:year>
                              <fr:month>3</fr:month>
                              <fr:day>19</fr:day>
                            </fr:date>
                            <fr:title text="TIFF in OCaml">TIFF in OCaml</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>I picked up from the excellent <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link> work of <fr:link href="https://patrick.sirref.org/tambe salome/" type="external">Tambe Salome</fr:link> in getting write-support in <fr:link href="/ocaml-tiff/" title="ocaml-tiff" uri="https://patrick.sirref.org/ocaml-tiff/" display-uri="ocaml-tiff" type="local">ocaml-tiff</fr:link>. We are getting closer to the kind of API I envisaged in this latest round of refinement and review.</html:p>
                            <html:pre class="hilite">
                              <html:code>
                                <html:span class="ocaml-keyword-other">let</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">/</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Eio</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Path</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">/</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-keyword">let</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-entity-name-function-binding">checkerboard</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">~</html:span>
                                <html:span class="ocaml-source">size</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-keyword">let</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-entity-name-function-binding">v</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">zeros</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">uint8</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[[|]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">size</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">size</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[|]]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">in</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-keyword">for</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-entity-name-function-binding">row</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">to</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">size</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">-</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">do</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">    </html:span>
                                <html:span class="ocaml-keyword">for</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-entity-name-function-binding">col</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">to</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">size</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">-</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">do</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">      </html:span>
                                <html:span class="ocaml-keyword-other">if</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                                <html:span class="ocaml-source">row</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">+</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">col</html:span>
                                <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">mod</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">2</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">then</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">set_item</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">row</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">col</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">254</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">v</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">    </html:span>
                                <html:span class="ocaml-keyword-other">done</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-keyword-other">done</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">to_bigarray</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">v</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-keyword-other">let</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Eio_posix</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">run</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">@@</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">fun</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">env</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Tiff_eio</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">with_open_out</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                                <html:span class="ocaml-source">env</html:span>
                                <html:span class="ocaml-keyword-other">#</html:span>
                                <html:span class="ocaml-source">cwd</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">/</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-string-quoted-double">"</html:span>
                                <html:span class="ocaml-string-quoted-double">example.tiff</html:span>
                                <html:span class="ocaml-string-quoted-double">"</html:span>
                                <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">@@</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">fun</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">w</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-keyword">let</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-entity-name-function-binding">tif</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-operator">=</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Tiff</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">make</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                                <html:span class="ocaml-source">checkerboard</html:span>
                                <html:span class="ocaml-source"> ~</html:span>
                                <html:span class="ocaml-source">size</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                                <html:span class="ocaml-constant-numeric-decimal-integer">256</html:span>
                                <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-keyword-other">in</html:span>
                                <html:span class="ocaml-source">
</html:span>
                                <html:span class="ocaml-source">  </html:span>
                                <html:span class="ocaml-constant-language-capital-identifier">Tiff</html:span>
                                <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                                <html:span class="ocaml-source">to_file</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">tif</html:span>
                                <html:span class="ocaml-source"> </html:span>
                                <html:span class="ocaml-source">w</html:span>
                                <html:span class="ocaml-source">
</html:span>
                              </html:code>
                            </html:pre>
                            <html:img src="/bafkrmiaqqczj5lemda5ijfjtjsyldbhmveu3btfvoa7rpt5k4dvdejjuhu.png" />
                            <html:p>I have also been extremely pleased to see further external collaborators appearing:</html:p>
                            <html:ul>
                              <html:li>
                                <html:p><fr:link href="https://github.com/geocaml/ocaml-tiff/pull/63" type="external">Nicolas</fr:link> helping out with metadata maintainence.</html:p>
                              </html:li>
                              <html:li>
                                <html:p><fr:link href="https://github.com/geocaml/ocaml-tiff/pull/62" type="external">Virgile</fr:link> adding support for reading multi-image TIFF files.</html:p>
                              </html:li>
                            </html:ul>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>12</fr:month>
                          <fr:day>15</fr:day>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/weekly-2025-w50/</fr:uri>
                        <fr:display-uri>weekly-2025-w50</fr:display-uri>
                        <fr:route>/weekly-2025-w50/</fr:route>
                        <fr:title text="Merry Shell(e)y">Merry Shell(e)y</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Aside from a serious amount of admin, last week I decided to spend a majority of my time thinking about shells.</html:p>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                              <fr:month>12</fr:month>
                              <fr:day>15</fr:day>
                            </fr:date>
                            <fr:title text="What is a shell?">What is a shell?</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>There is no single definition of what a shell is or isn't.</html:p>
                            <html:blockquote />
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                              <fr:month>12</fr:month>
                              <fr:day>15</fr:day>
                            </fr:date>
                            <fr:uri>https://patrick.sirref.org/ai-blues/</fr:uri>
                            <fr:display-uri>ai-blues</fr:display-uri>
                            <fr:route>/ai-blues/</fr:route>
                            <fr:title text="AI Blues ">AI Blues </fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>Undoubtedly last week, I suffered a severe case of "AI blues" (for lack of a better description).</html:p>
                            <html:p>I have been doing some thinking, trying to distil my own thoughts on what aspects of <html:em>vibecoding</html:em> seem to irk me so much. Ultimately, it seems it is more about attitudes than anything else.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                              <fr:month>12</fr:month>
                              <fr:day>15</fr:day>
                            </fr:date>
                            <fr:title text="Exploitative">Exploitative</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>Increasingly, I am finding that other people's vibecoded work <html:em>is</html:em> my problem. I have been an active participant in OCaml's <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">outreachy</fr:link> work for going on five years now, and a problem mentors have to face is deciding the appropriate amount of help to give to your intern when they come to you with questions. More than likely, you could answer with specifics and solve the problem at hand. However, this doesn't scale very well and doesn't help your intern learn where else they may look for answers (e.g. <fr:link href="https://patrick.sirref.org/dune.readthedocs.io" type="external">Dune's documentation</fr:link>, a project's README page, <fr:link href="https://ocaml.org/packages" type="external">OCaml's package explorer</fr:link>, heck even just using some simple CLI tools!) or how they might go about debugging a certain problem.</html:p>
                            <html:p>LLMs, in my experience, make this problem worse. When they come up short, they can leave their programmer higher and drier than they would be had they hit a problem on their own. There is an inertia to understanding problems now that there's lots of code lying around. Turning to your colleagues has a few problems that it didn't before:</html:p>
                            <html:ol>
                              <html:li>
                                <html:p>Your colleagues don't know whose understanding they are correcting: yours or the LLMs?</html:p>
                              </html:li>
                              <html:li>
                                <html:p>If it is the latter, there seems to me to be an exploitative quality to even asking for help until you yourself know what's going wrong.</html:p>
                              </html:li>
                            </html:ol>
                            <fr:tree show-metadata="false">
                              <fr:frontmatter>
                                <fr:authors>
                                  <fr:author>
                                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                                  </fr:author>
                                </fr:authors>
                                <fr:date>
                                  <fr:year>2025</fr:year>
                                  <fr:month>12</fr:month>
                                  <fr:day>15</fr:day>
                                </fr:date>
                                <fr:title text="Technological Accelerationism">Technological Accelerationism</fr:title>
                              </fr:frontmatter>
                              <fr:mainmatter>
                                <html:p>There is no doubt that LLMs are pretty good at writing large amounts of okay code. The generation of this code, and often subsequent publishing of it, completely outpaces the ability to maintain it.</html:p>
                                <html:p>Programmers may be able to release ten times more libraries than they could before, but at the moment, they certainly cannot maintain ten times more libraries than they could before.</html:p>
                                <html:ol>
                                  <html:li />
                                  <html:li>
                                    <html:p>Scale --</html:p>
                                  </html:li>
                                </html:ol>
                              </fr:mainmatter>
                            </fr:tree>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:uri>https://patrick.sirref.org/modular-explicits/</fr:uri>
                <fr:display-uri>modular-explicits</fr:display-uri>
                <fr:route>/modular-explicits/</fr:route>
                <fr:title text="Modular Explicits in OCaml">Modular Explicits in OCaml</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Abstraction, in OCaml, often refers to hiding a particular type's implementation using a <html:em>signature</html:em>. For example:</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-keyword-other">module</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">sig</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword">type</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-entity-name-function-binding">t</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword">val</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-entity-name-function-binding">add</html:span>
                    <html:span class="ocaml-source"> : t -&gt; t -&gt; t
</html:span>
                    <html:span class="ocaml-keyword-other">end</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">struct</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword-other">type</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-support-type">int</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword">let</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-entity-name-function-binding">add</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Int</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">add</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-other">end</html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <html:p>In this post, however, I use abstraction to refer to the notion of code-reuse. Using features of the OCaml language to allow one piece of code to be used across different implementations or instantiations of a particular kind of value.</html:p>
                <html:p>The goal of this post is to eventually discuss OCaml 5.5's <fr:link href="/abs-modular-explicits/" title="Modular Explicits " uri="https://patrick.sirref.org/abs-modular-explicits/" display-uri="abs-modular-explicits" type="local">modular explicits</fr:link> which is yet another feature that can allow a single piece of code to be used in various situations.</html:p>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/abs-polymorphism/</fr:uri>
                    <fr:display-uri>abs-polymorphism</fr:display-uri>
                    <fr:route>/abs-polymorphism/</fr:route>
                    <fr:title text="Polymorphism ">Polymorphism </fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>The most prevalent kind of abstraction is polymorphism. For example, <html:code>List.length</html:code> will work for all lists regardless of what kind of elements the list contains. However, polymorphism requires you to keep the polymorphic part of the type at arm's length. This can lead to suboptimal performance and/or limited usefulness.</html:p>
                    <html:p><html:code>List.mem</html:code> is a good example; in order to be polymorphic <html:code>List.mem</html:code> relies on <html:code>Stdlib.(=)</html:code>, the polymorphic equality operator. In turn, this operator achieves its polymorphism by performing a structural comparison of the runtime representation of its arguments.</html:p>
                    <html:p>A common way to overcome this is to use higher-order functions (functions that take functions as arguments).</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">rec </html:span>
                        <html:span class="ocaml-entity-name-function-binding">mem</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-variable-parameter-optional">?</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-variable-parameter-optional">eq</html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Stdlib</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-boolean">false</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">xs</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">eq</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">||</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">mem</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">eq</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">xs</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">mem</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> ?</html:span>
                        <html:span class="ocaml-source">eq</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">bool</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">list</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">bool</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">mem_int_list</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">mem</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">eq</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Int</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">equal</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">mem_int_list</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">list</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">bool</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>This works well in plenty of cases (<html:code>List.map</html:code>, <html:code>Hashtbl.iter</html:code>, etc.), however, it doesn't scale well from a user's perspective if the body of the function requires lots of specific functions (e.g. <html:code>compare</html:code>, <html:code>length</html:code>, <html:code>pp</html:code>). At the same time, we want to avoid the precarious duck-typing of something like Python too.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/abs-functors/</fr:uri>
                    <fr:display-uri>abs-functors</fr:display-uri>
                    <fr:route>/abs-functors/</fr:route>
                    <fr:title text="Functors ">Functors </fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Functors are perhaps the second most prevalent feature of OCaml when it comes to code reuse. In the OCaml sense, a functor is a module that is parameterised by other modules. <html:code>Set.Make</html:code> is a functor that requires a module adhereing to the <html:code>Set.OrderedType</html:code> interface.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Int</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">String</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Functors make it a lot easier to write implementations that depend on a large variety of functionality. <html:code>Set.OrderedType</html:code> is relatively tame in this sense, only needing a type <html:code>t</html:code> and a <html:code>compare : t -&gt; t -&gt; int</html:code> function.</html:p>
                    <html:p><fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>, on the other hand, has functors that require users to provide <fr:link href="https://ocaml.org/p/irmin/3.11.0/doc/irmin/Irmin/Schema/module-type-S/index.html" type="external">Schemas</fr:link>. I have more thoughts about this API design in <fr:link href="/irmin-retro/" title="Irmin Retrospective" uri="https://patrick.sirref.org/irmin-retro/" display-uri="irmin-retro" type="local">my Irmin retrospective</fr:link>.</html:p>
                    <html:p>It is important to consider the runtime costs of functors too. Whilst most of the time functors are instantiated at the toplevel, it does not come for free. You can have a play around with <fr:link href="https://patricoferris.github.io/js_of_ocamlopt/#code=bGV0IGYgaSA9CiAgbGV0IG1vZHVsZSBJID0gU2V0Lk1ha2UgKEludCkgaW4KICBJLmNhcmRpbmFsIGk=" type="external">js_of_ocamlopt</fr:link> and see the generated output for how functors are applied.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/abs-fcm-exist/</fr:uri>
                    <fr:display-uri>abs-fcm-exist</fr:display-uri>
                    <fr:route>/abs-fcm-exist/</fr:route>
                    <fr:title text="First-class Modules and Existentials ">First-class Modules and Existentials </fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Sitting somewhere inbetween polymorphism and functors are first-class modules with existentials. This is a rather advanced use of OCaml's type system to be able to <html:em>pack</html:em> together a value of a particular type alongside a module that works with those kinds of values.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">with</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">set</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">size</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">s</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">cardinal</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">s</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Packaging up integer sets is fairly straight-forward.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">int_empty_set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">empty</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">int_empty_set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-source">poly</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>From a user's perspective we are now closer to the realm of dynamic typing. Indeed, existentials are the way to do that in OCaml.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">any</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">any</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">any</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Getting back into a typed world often involves some <fr:link href="https://github.com/dbuenzli/hmap/blob/e54eb3f7d7dbada0724fd023c334d0b5a29c8479/src/hmap.ml#L120-L127" type="external">type witness gymnastics</fr:link> or runtime exceptions. Used sparingly, however, it can be very effective particularly when a user is none the wiser about the use of FCMs and existentials. I have made use of this trick to <fr:link href="https://github.com/fn06/shelter/blob/e71d6df79ab7c43b092de145e9e80482ae3af118/src/lib/store.ml#L1-L10" type="external">package together Irmin stores with implementations</fr:link>.</html:p>
                    <html:p>You could not, however, simply return the value that was packed away inside the existential.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">woops</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language">_</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">s</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">s</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">characters</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">26</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">27</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Error</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">The</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">value</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">s</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">has</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">$</html:span>
                        <html:span class="ocaml-source">a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">but</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">an</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expression</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">was</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expected</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">of</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">       </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">The</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">constructor</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">$</html:span>
                        <html:span class="ocaml-source">a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">would</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">escape</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">its</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">scope</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">       </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Hint</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">$</html:span>
                        <html:span class="ocaml-source">a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">is</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">an</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">existential</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">bound</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">by</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">the</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">constructor</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>There is also a runtime cost to the packing (and unpacking) of the module, not to mention the need for the extra allocation to create the existential in the first place. This will likely not be too significant, but is worth considering.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/abs-modular-explicits/</fr:uri>
                    <fr:display-uri>abs-modular-explicits</fr:display-uri>
                    <fr:route>/abs-modular-explicits/</fr:route>
                    <fr:title text="Modular Explicits ">Modular Explicits </fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>OCaml 5.5 has <html:em>module-dependent function types</html:em> also known as <html:em>explicits modular</html:em>. The type of a function can now depend on types that come from a module that is also part of the function definition.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">set_length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">cardinal</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">set_length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">set_length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">empty</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">set_length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">empty</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>In fact, we can now <html:em>return</html:em> values of a particular type that depends on a particular module!</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">empty_set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">empty</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">empty_set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">empty_set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-source">abstr</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">empty_set</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-source">abstr</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Or, we can dynamically select implementations and values.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">with_impl</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source">config</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-support-type">string</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">config</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">fn</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">match</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">String</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">lowercase_ascii</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">config</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">with</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">string</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">fn</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">StringSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">empty</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">int</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">fn</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">IntSet</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">empty</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">c</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">invalid_arg</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">c</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">with_impl</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">config</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-support-type">string</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Set</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">S</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>This is like a more usable version of the FCM-existential trick, though does require more manual type annotations on functions. For instance, I tried switching out <fr:link href="https://github.com/ocurrent/obuilder" type="external">OBuilder's</fr:link> use of existentials with modular explicits:</html:p>
                    <html:pre><![CDATA[-type builder = Builder : (module Obuilder.BUILDER with type t = 'a) * 'a -> builder
-
 let log tag msg =
   match tag with
   | `Heading -> Fmt.pr "%a@." Fmt.(styled (`Fg (`Hi `Blue)) string) msg
   | `Note -> Fmt.pr "%a@." Fmt.(styled (`Fg `Yellow) string) msg
   | `Output -> output_string stdout msg; flush stdout

-let create_builder store_spec conf =
+let create_builder :
+  Store_spec.store Lwt.t -> Native_sandbox.config ->
+    ((module B : Obuilder.BUILDER) -> B.t -> 'a) -> 'a Lwt.t =
+  fun store_spec conf fn ->
   store_spec >>= fun (Store_spec.Store ((module Store), store)) ->
   let module Builder = Obuilder.Builder (Store) (Native_sandbox) (Docker_extract) in
   Native_sandbox.create ~state_dir:(Store.state_dir store / "sandbox") conf >|= fun sandbox ->
   let builder = Builder.v ~store ~sandbox in
-  Builder ((module Builder), builder)
+  fn (module Builder) builder]]></html:pre>
                    <html:p>I think the code is more pragmatic; there is no longer an indirection via a type called <html:code>builder</html:code>. The extra type annotations do add a little noise. Roll on <html:em>modular implicits</html:em>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2026</fr:year>
                  <fr:month>3</fr:month>
                  <fr:day>9</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/vibecoding-etiquette/</fr:uri>
                <fr:display-uri>vibecoding-etiquette</fr:display-uri>
                <fr:route>/vibecoding-etiquette/</fr:route>
                <fr:title text="Vibecoding Etiquette">Vibecoding Etiquette</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>I am yet to jump head-first into using LLM-based tools like Claude Code or even ChatGPT to help with my programming in any serious way. After using some "free"-tier tools to try to better understand some tricky eBPF problems and to make sense of the semantics of POSIX shells, I was left unimpressed and ultimately felt my time was wasted.</html:p>
                <html:p>I feel unwilling to send my money to the corporations behind these tools. This is for a variety of reasons including the deeply worrying relationship with the US Department of War (I struggle to find the meaningful difference between <fr:link href="https://www.anthropic.com/news/where-stand-department-war" type="external">"opertational planning" vs. "operational decision-making" given the leaders of the US DoW</fr:link>), environmental concerns, exploitation of human labour and a fast-and-loose approach to copyright laws. All of which leaves the entire industry very unattractive to me.</html:p>
                <html:p>Everybody can draw their line where they want, and I am, in good faith, trying to find where mine should be.</html:p>
                <html:p>Unfortunately, my own decision to not use these tools is not completely in my control. What do I do about pull requests to open-source libraries I maintain that include agentic code? I am, after all, participating in the idea of open-source and inclusive collaboration. Agentic code also comes in many flavours, from blatant LLM-generated pull requests to heavily edited, human-in-the-loop contributions.</html:p>
                <html:p>An immediate first step for me is to develop some policy for contributions to projects I maintain regarding code where LLMs have had a hand. This can help set expectations for contributors. <fr:link href="https://github.com/ocaml-multicore/eio/blob/main/HACKING.md#ai-generated-code" type="external">Eio's "AI-generated Code"</fr:link> subsection is succinct and prohibits contributions that <html:em>solely</html:em> use AI.</html:p>
                <html:blockquote>
                  <html:p>It obfuscates how you think. Purely AI-generated code tells us little about how you think and the problems you might be having. This makes it harder to provide good feedback on PRs and issues.</html:p>
                  <html:p>It is often more work to review. Particularly for the OCaml ecosystem and libraries like Eio, it seems that these tools are not very good and generate a lot of believable code that is in actual fact completely wrong. PR comments and the code submitted with them can say completely different things.</html:p>
                  <html:p>It is a grey area for licensing. Models like ChatGPT have been trained on lots of code with different licenses and has been known to simply copy code as an answer to a prompt. We would like to avoid this headache as best we can.</html:p>
                </html:blockquote>
                <html:p>Additionally, I plead to other developers to <html:em>own</html:em> their use of these tools. Please, make Claude a co-author of the commits where Claude has generated <html:em>any</html:em> code at the very least. This is the bare minimum. I have strong feelings about the etiquette of sending AI summarised information or LLM-generated code to other people, but before any of that, the decent thing is to remove any uncertainty in the receiving party's mind of how the information they are receiving came to be. In this way, I appreciate the <fr:link href="https://github.com/ocaml/ocaml/blob/trunk/AI.md" type="external">OCaml compiler's AI notice</fr:link> which includes:</html:p>
                <html:blockquote>
                  <html:p>If a significant portion of your code, PR description, review comments or messages has been AI-generated, this must be disclosed, stating which tool was used and for what. Reviewing AI-produced code can require a different approach from human-written code. You should have an acknowledgement anyway even if another human contributor did some of the work.</html:p>
                </html:blockquote>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>10</fr:month>
                  <fr:day>24</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/icfp-2025/</fr:uri>
                <fr:display-uri>icfp-2025</fr:display-uri>
                <fr:route>/icfp-2025/</fr:route>
                <fr:title text="ICFP 2025">ICFP 2025</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Two weeks ago I was fortunate enough to attend the <fr:link href="https://icfp25.sigplan.org/" type="external">International Conference on Functional Programming</fr:link> in Singapore. My first time in Asia and my second time at the conference, what follows are some thoughts and presentations I enjoyed whilst I was there.</html:p>
                <html:p>I must thank my office mate (and friend!) <fr:link href="https://ryan.freumh.org/" type="external">Ryan Gibb</fr:link> for his camaraderie and sage advice: "the best track is <html:em>hallway</html:em> track". Not to mention all of his <fr:link href="https://ryan.freumh.org/photos.html" type="external">photos</fr:link> too. Thanks Ryan!</html:p>
                <html:div style="text-align: center">
  <html:img class="inner-img" src="/bafkrmid2d6u3qdufa6m5gogavtwm6uqksaicozrc5s2unrtzjtth3hpvey.jpeg" alt="Description follows image." />
</html:div>
                <html:p>From right to left, top to bottom: <fr:link href="https://patrick.sirref.org/anil madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>, <fr:link href="https://patrick.sirref.org/sadiq jaffer/" type="external">Sadiq Jaffer</fr:link>, <fr:link href="https://patrick.sirref.org/patrick ferris/" type="external">Patrick Ferris</fr:link>, <fr:link href="https://patrick.sirref.org/ryan gibb/" type="external">Ryan Gibb</fr:link> and <fr:link href="https://patrick.sirref.org/roy ang/" type="external">Roy Ang</fr:link>.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>10</fr:month>
                      <fr:day>24</fr:day>
                    </fr:date>
                    <fr:title text="Random Hacking">Random Hacking</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Below are just some of the pieces of random hacking I got up to whilst in Singapore.</html:p>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:uri>https://patrick.sirref.org/oxcaml-and-uring/</fr:uri>
                        <fr:display-uri>oxcaml-and-uring</fr:display-uri>
                        <fr:route>/oxcaml-and-uring/</fr:route>
                        <fr:title text="OxCaml and Uring">OxCaml and Uring</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Jane Street were a big presence at ICFP 2025, carting along with them a shiny new OCaml compiler: <fr:link href="https://oxcaml.org/" type="external">OxCaml</fr:link>. If have been <fr:link href="/try-oxcaml/" title="Try OxCaml" uri="https://patrick.sirref.org/try-oxcaml/" display-uri="try-oxcaml" type="local">playing around with OxCaml recently</fr:link> but nothing outside toplevels in Javascript. Until now!</html:p>
                        <html:p>After talking to <fr:link href="/dra27/" title="David Allsopp" uri="https://patrick.sirref.org/dra27/" display-uri="dra27" type="local">David</fr:link>, I spent some time converting a small corner of the <fr:link href="https://github.com/ocaml-multicore/ocaml-uring" type="external">ocaml-uring</fr:link> library to use a part of <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link>. In particular making the following change:</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">module</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">struct</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword-other">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">ptr</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-support-type">int32</html:span>
                            <html:span class="ocaml-keyword-other">#</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                            <html:span class="ocaml-comment-block"> ... </html:span>
                            <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">end</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">cqe</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-source">user_data_id</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">ptr</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-source">res</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-support-type">int32</html:span>
                            <html:span class="ocaml-keyword-other">#</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>The idea being that a completion queue entry (a notification that some operation has completed) could be fully represented using 64 bits (two 32-bit, <fr:link href="https://oxcaml.org/documentation/unboxed-types/01-intro/" type="external">unboxed values</fr:link>). You can <fr:link href="https://github.com/ocaml-multicore/ocaml-uring/compare/main...patricoferris:ocaml-uring:oxcaml?expand=1" type="external">see how this impacted the library</fr:link>! I'm not certain about this change (and I'm sure I did it wrong) but it was nice to realise <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> gives you this kind of control. However, I am worried about the ergonomics of manipulating values like <html:code>int32#</html:code> and the temptation to case it into an <html:code>int</html:code> (presumably losing a good portion of the value of having an unboxed value in the first place).</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>10</fr:month>
                          <fr:day>24</fr:day>
                        </fr:date>
                        <fr:title text="Bibtex Parser">Bibtex Parser</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>On the flight over to Singapore, I started to write a post for this website. Some readers may remember that I use <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link> after a preprocessing step via <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">graft</fr:link> to build this site. Part of that preprocessing consumes bibtex files and outputs forester trees. For the initial <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">graft</fr:link> release I used the excellent <fr:link href="https://github.com/Octachron/talaria_bibtex" type="external">Talaria Bibtex</fr:link> library. Unfortunately, it presented a pretty confusing API that, whilst nicely typed, felt a little cumbersome to use. Additionally, it was too specific in what it would accept as valid Bibtex. I wanted something that was a little more straight-forward to use (if a little fast-and-loose when it comes to types...). And so I built <fr:link href="/bib/" title="Bib" uri="https://patrick.sirref.org/bib/" display-uri="bib" type="local">bib</fr:link>.</html:p>
                        <html:p>This was my first real attempt at using the <fr:link href="https://ocaml.org/p/bytesrw" type="external">Bytesrw</fr:link> library. I was happy with the results, although I did have to copy a substantial amount of code from <fr:link href="https://ocaml.org/p/jsont" type="external">other bytesrw-compatible libraries</fr:link>. I'd be happy to shift to this <html:code>bytes</html:code>-first world if it wasn't for the ever-present-in-my-mind issue of relocatable values in the OCaml heap!</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>10</fr:month>
                          <fr:day>24</fr:day>
                        </fr:date>
                        <fr:title text="Geocaml Libraries">Geocaml Libraries</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>There has been some excellent <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">outreachy</fr:link> work happening on the <fr:link href="https://github.com/geocaml/ocaml-tiff" type="external">geocaml/ocaml-tiff</fr:link> library which is a potential Outreachy internship project for December 2025. More on this in a future post.</html:p>
                        <html:p>On the way back (and a little during the conference), I spent some time building an OCaml counterpart to <fr:link href="https://github.com/ucam-eo/geotessera/" type="external">geotessera</fr:link>, a library for working with <fr:link href="/tessera2025/" title="TESSERA: Temporal Embeddings of Surface Spectra for Earth Representation and Analysis" uri="https://patrick.sirref.org/tessera2025/" display-uri="tessera2025" type="local">Tessera</fr:link>. The library is not ready for people to use directly, but I was working on various constituent parts including:</html:p>
                        <html:ul>
                          <html:li>
                            <html:p><fr:link href="https://github.com/geocaml/ocaml-proj" type="external">Modern OCaml bindings to PROJ</fr:link> (a coordinate reference system projection library)</html:p>
                          </html:li>
                          <html:li>
                            <html:p>
                              <fr:link href="https://github.com/geocaml/ocaml-wkt" type="external">Further work on a WKT library for OCaml</fr:link>
                            </html:p>
                          </html:li>
                          <html:li>
                            <html:p>Coming soon... ocaml-geotessera</html:p>
                          </html:li>
                        </html:ul>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>10</fr:month>
                      <fr:day>24</fr:day>
                    </fr:date>
                    <fr:title text="Talks">Talks</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>10</fr:month>
                          <fr:day>24</fr:day>
                        </fr:date>
                        <fr:title text="Hazel of OCaml at TyDe">Hazel of OCaml at TyDe</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>The <html:em>type-driven development</html:em> (TyDe) workshop was held on the first day of ICFP at the <fr:link href="https://www.comp.nus.edu.sg/" type="external">NUS School of Computing</fr:link>. I find the workshop name to be a little misleading, but perhaps this comes from my engineering background. The talks focused a lot on type <html:em>theory</html:em>, presenting the formal mathematics of interesting type systems with less focus on <html:em>why</html:em> it might be useful to have such an exotic type system... but then again, that was the nature of the entire conference.</html:p>
                        <html:p>I presented a talk on <fr:link href="/hazel-of-ocaml/" title="A Transpiler from OCaml to Hazel" uri="https://patrick.sirref.org/hazel-of-ocaml/" display-uri="hazel-of-ocaml" type="local">hazel_of_ocaml</fr:link>. The <fr:link href="https://patrick.sirref.org/var/tyde2025.pdf" type="external">slides are here</fr:link>, along with the <fr:link href="https://patrick.sirref.org/var/tyde2025-ea.pdf" type="external">extended abstract</fr:link>. My talk ended up focusing a lot on the pedagogical benefits of having a type system that helped explain the most important thing a type system does... catch type errors! This work represents a small piece of work inside <fr:link href="https://maxcarroll0.github.io/" type="external">Max Carroll's</fr:link> excellent <fr:link href="/part-ii-hazel/" title="Type Error Debugging in Hazel" uri="https://patrick.sirref.org/part-ii-hazel/" display-uri="part-ii-hazel" type="local">part II</fr:link> project, which he presented at the <fr:link href="https://maxcarroll0.github.io/papers/workshops/HATRA-decomposable-type-highlighting/" type="external">HATRA workshop</fr:link>: <html:em>Decomposable Type Highlighting for Bidirectional Type and Cast Systems</html:em>.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>10</fr:month>
                          <fr:day>24</fr:day>
                        </fr:date>
                        <fr:title text="Scientific Programming at PROPL">Scientific Programming at PROPL</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>I think it is important to be honest whenever you get a talk accepted that you otherwise feel should not have been. My talk "<html:em>about scientific programming what we talk about when we talk</html:em>" is one such talk. The <fr:link href="https://patrick.sirref.org/var/propl2025.pdf" type="external">slides are here</fr:link>. The talk itself was nothing to write home about, but I think there were a few nice ideas that came out of it and the conversations I had with fellow PROPL attenders.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                              <fr:month>10</fr:month>
                              <fr:day>24</fr:day>
                            </fr:date>
                            <fr:title text="TMF Data Discrepancies Redux">TMF Data Discrepancies Redux</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>On the eve of my talk, I decided to re-run some analysis I did a few years ago on the <fr:link href="https://forobs.jrc.ec.europa.eu/TMF/data#downloads" type="external">tropical moist forest dataset</fr:link>, knowing that since then a few more years had become available. After fighting with some bit-rot in the Google Earth Engine script I had used, the new results were not very uplifting.</html:p>
                            <html:table>
    <html:tbody>
    <html:tr>
    <html:td><html:strong>Land Use Class</html:strong></html:td>
    <html:td><html:strong>Percent Change</html:strong></html:td>
    </html:tr>
    <html:tr>
    <html:td>Undisturbed</html:td>
    <html:td> -2.9</html:td>
    </html:tr>
    <html:tr>
    <html:td>Degraded</html:td>
    <html:td> -5.5</html:td>
    </html:tr>
    <html:tr style="background: yellow">
    <html:td>Deforested</html:td>
    <html:td> 8.6</html:td>
    </html:tr>
    <html:tr>
    <html:td>Regrowth</html:td>
    <html:td> 0.5</html:td>
    </html:tr>
    <html:tr>
    <html:td>Water</html:td>
    <html:td> 0.0</html:td>
    </html:tr>
    <html:tr>
    <html:td>Other</html:td>
    <html:td>-0.6</html:td>
    </html:tr>
    </html:tbody>
</html:table>
                            <html:p>The data in the table corresponds to the land use class values in Indonesia in the year 2008. The analysis computed the difference across each of the classes between the dataset released in 2021 and the dataset released in 2024. Most notably, the amount of deforested land has gone up by <html:em>8.6</html:em> percent!</html:p>
                            <html:p>As a somewhat tangential, though related, aside, I had the pleasure of talking to <fr:link href="https://cs.nyu.edu/~shw8119/" type="external">Sam Westrick</fr:link>, <fr:link href="https://forthoney.github.io/" type="external">Seong-Heon Jung</fr:link> and <fr:link href="https://svishnus.github.io/" type="external">Sundara Vishnu Satish</fr:link> of the <fr:link href="https://nyu-parcour.github.io/" type="external">ParCour</fr:link> research group. They were telling me about <fr:link href="https://github.com/mpllang/mpl" type="external">MaPLe</fr:link>, a programming language from the MLs built for parallelism. We discussed some ideas of using real-world, geospatial algorithms as benchmarks for MaPLe. <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link>, if you got this far remind me to chat to you about this!</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                              <fr:month>10</fr:month>
                              <fr:day>24</fr:day>
                            </fr:date>
                            <fr:title text="Shelter Reactions">Shelter Reactions</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>At the end of my talk, I briefly mentioned <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">shelter</fr:link>. By far, this was the topic I got the most engagement on post-talk. During the conference, this was also true when people asked what I was working on. The tag line "a shell with <html:em>undo</html:em>" seemed to capture the attention of most people.</html:p>
                            <html:p>I'm feeling a renewed sense of interest in my own work thanks to that, even if the "research" contributions are not very apparent. However, I also had a good discussion with <fr:link href="https://kcsrk.info/" type="external">KC</fr:link> about the underlying <fr:link href="https://patrick.sirref.org/mrdt/" type="external">MRDT</fr:link> in <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> and how we might think about collaborating in the future on MRDT-related work.</html:p>
                            <html:p>Related to that, I managed to spend the evening in <fr:link href="https://www.openstreetmap.org/relation/18195609#map=16/1.28090/103.84222" type="external">Chinatown</fr:link> with <fr:link href="https://dynamicaspects.org/research/" type="external">Roly Perera</fr:link>. Roly's work has focused on <fr:link href="https://f.luid.org/" type="external">Fluid</fr:link>, a transparency-based programming language that allows authors to reveal their computation to their user. Excitingly, Roly presented a <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/propl-2025-papers/10/Authoring-Tools-for-Transparent-Climate-Reporting" type="external">new text-based part of the language</fr:link> at PROPL. Our work is in the same universe, loosely orbiting some notion of reproducibility and explainability, but quite different in engineering work and how users might actually interact with our systems. I thoroughly enjoyed talking about solutions or research ideas that <html:em>preserve</html:em> existing workflows. Roly was great at pulling that out of the current work I have been doing.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>10</fr:month>
                      <fr:day>24</fr:day>
                    </fr:date>
                    <fr:title text="Other Talks and Highlights">Other Talks and Highlights</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>I was a part of, often in a very small way, some other talks that were presented at ICFP including</html:p>
                    <html:ul>
                      <html:li>
                        <html:p><fr:link href="https://www.youtube.com/watch?v=j84ocjlj1JA&amp;amp;t=12880s" type="external">Functional Networking for Docker</fr:link>, I encourage you to read <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil's</fr:link> <fr:link href="https://anil.recoil.org/notes/icfp25-ocaml5-js-docker#functional-networking-at-docker" type="external">notes on the topic</fr:link>. It is also worth mentioning <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil's</fr:link> <fr:link href="https://anil.recoil.org/notes/icfp25-post-posix" type="external">post-posix talk</fr:link> (not unrelated to my Uring musings above).</html:p>
                      </html:li>
                      <html:li>
                        <html:p><fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link> gave an excellent, <html:em>very live</html:em>, talk about <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/propl-2025-papers/6/Yirgacheffe-a-declarative-approach-to-geospatial-data" type="external">Yirgacheffe</fr:link> at PROPL which I thoroughly enjoyed. I'm also excited about his recent developments which I'm sure you can clue into <fr:link href="https://digitalflapjack.com/weeknotes/" type="external">over on his blog</fr:link>.</html:p>
                      </html:li>
                    </html:ul>
                    <html:p>Below is a non-exhaustive list of talks I enjoyed whilst at the conference. Some relevant, most of them not!</html:p>
                    <html:ul>
                      <html:li>
                        <html:p>By far, one of the best talks was <fr:link href="https://icfp25.sigplan.org/details/icfp-2025-papers/13/Polynomial-Time-Program-Equivalence-for-Machine-Knitting" type="external">Polynomial-time Program Equivalence for Machine Knitting</fr:link>. I think the talk really nailed the "here's the idea, the details are in the paper"-presenting style as they described an "...algorithm that canonicalizes the algebraic representations of the topological semantics of machine knitting programs".</html:p>
                      </html:li>
                      <html:li>
                        <html:p>I attended most of the <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/icfp-splash-2025-tutorials/5/A-guided-tour-through-Oxidized-OCaml" type="external">OxCaml tutorial</fr:link> presented by the incredibly friendly <fr:link href="https://gavinleroy.com/" type="external">Gavin Gray</fr:link>.</html:p>
                      </html:li>
                      <html:li>
                        <html:p><fr:link href="/ryangibb/" title="Ryan Gibb" uri="https://patrick.sirref.org/ryangibb/" display-uri="ryangibb" type="local">Ryan</fr:link>'s talk <fr:link href="https://conf.researchr.org/details/icfp-splash-2025/propl-2025-papers/13/Spatial-Programming-for-Environmental-Monitoring" type="external">Spatial Programming for Environmental Monitoring</fr:link> at PROPL was excellent.</html:p>
                      </html:li>
                    </html:ul>
                    <html:p>There's plenty more to talk about, and I'm sure my future posts will reference other parts of my experience at ICFP 2025. Thanks for reading, and if anybody is interested in any aspects of this do reach out!</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>8</fr:month>
                  <fr:day>7</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/irmin-retro/</fr:uri>
                <fr:display-uri>irmin-retro</fr:display-uri>
                <fr:route>/irmin-retro/</fr:route>
                <fr:title text="Irmin Retrospective">Irmin Retrospective</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> is an OCaml library for building <html:em>branchable</html:em> and <html:em>mergeable</html:em> data stores. The data is <html:em>mergeable</html:em> in the sense of <fr:link href="/kcrsk-mrdts-2022/" title="Certified mergeable replicated data types" uri="https://patrick.sirref.org/kcrsk-mrdts-2022/" display-uri="kcrsk-mrdts-2022" type="local">mergeable replicated data types</fr:link>.</html:p>
                <html:p>I have been using Irmin for over five years to build different kinds of interesting data stores including:</html:p>
                <html:ul>
                  <html:li>
                    <html:p>A <fr:link href="https://github.com/patricoferris/omditor" type="external">simple markdown-based note-taking web application</fr:link>.</html:p>
                  </html:li>
                  <html:li>
                    <html:p>A <fr:link href="https://github.com/carboncredits/retirement-db" type="external">content-addressed database</fr:link>.</html:p>
                  </html:li>
                  <html:li>
                    <html:p>Mentoring an intern who <fr:link href="https://tarides.com/blog/2022-08-02-irmin-in-the-browser/" type="external">worked on Irmin in the browser</fr:link>.</html:p>
                  </html:li>
                  <html:li>
                    <html:p>Most recently, an <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Irmin-backed shell session manager</fr:link>.</html:p>
                  </html:li>
                </html:ul>
                <html:p>I was asked to provide some feedback recently on <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>, so I thought writing a little retrospective here would be a good way to do that. The remit for the retrospective was about improving <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>, so the content is focussed on pain points and areas of improvement.</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                    <html:span class="ocaml-comment-block"> An in-memory Irmin store </html:span>
                    <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-other">module</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Irmin_mem</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">KV</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Irmin</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Contents</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">String</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>8</fr:month>
                      <fr:day>7</fr:day>
                    </fr:date>
                    <fr:title text="What is Irmin?">What is Irmin?</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>, at its simplest, is a key-value database. Users associate keys with values and can query and update these bindings.</html:p>
                    <html:p>Additionally, this database supports versioning. This means independent snapshots of the database can coexist and users can switch between them and update them without fear of interfering with other versions.</html:p>
                    <html:p>Different versions of the database can be combined by <html:em>merging</html:em>. When you set up your instance of an <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> database, you also provide it with a <fr:link href="/kcrsk-mrdts-2022/" title="Certified mergeable replicated data types" uri="https://patrick.sirref.org/kcrsk-mrdts-2022/" display-uri="kcrsk-mrdts-2022" type="local">merge function</fr:link>.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">#</html:span>
                        <html:span class="ocaml-keyword-other">show_type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Irmin</html:span>
                        <html:span class="ocaml-source">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Merge</html:span>
                        <html:span class="ocaml-source">.</html:span>
                        <html:span class="ocaml-source">f</html:span>
                        <html:span class="ocaml-source">;;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">nonrec</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">f</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source">old</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Irmin</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Merge</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">promise</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Irmin</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Merge</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">conflict</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">result</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lwt</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>8</fr:month>
                      <fr:day>7</fr:day>
                    </fr:date>
                    <fr:title text="Design and API">Design and API</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>'s API is very git-inspired. There is a large overlap of shared vocabulary and concepts: <html:em>repositories</html:em>, <html:em>branches</html:em>, <html:em>commits</html:em>, <html:em>heads</html:em> etc.</html:p>
                    <html:p>Probably the most confusing aspect of this is the notion of a <html:code>Store</html:code>. When I was describing <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> above, I used the term <html:em>database</html:em> to help distinguish between some of these concepts. In Irmin's documentation, it is used for multiple related (but different) concepts. In "<fr:link href="https://irmin.org/tutorial/getting-started/#creating-a-store" type="external">Creating a Store</fr:link>" stores refer to the entire database, whereas in the <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> API docs we have that:</html:p>
                    <html:blockquote>
                      <html:p>There are two kinds of store in Irmin: the ones based on persistent named branches and the ones based temporary detached heads.</html:p>
                    </html:blockquote>
                    <html:p>For <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> library users, a <html:code>Store.t</html:code> can be thought of as a checkout of the database at a particular revision. This may be from a branch or a specific commit.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">of_branch</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">repo</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">string</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lwt</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">of_commit</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">commit</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Store</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lwt</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">&lt;</html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-keyword-operator">&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>The overloading of the term is confusing. I think it leaves users unsure about what other people might mean when they say "store". Being careful with these terms, and the contexts in which they are used, would help avoid this confusion.</html:p>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Module and Functor Soup">Module and Functor Soup</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Undoubtedly for a majority of use-cases and users, <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> is over-functorised. Nearly every module requires that you must apply some functor to access any useful code. In general, a user will have to interact with the <fr:link href="https://mirage.github.io/irmin/irmin/Irmin/module-type-S/Schema/index.html" type="external"><html:code>Schema</html:code> module</fr:link> when describing the types they want to instantiate their store with.</html:p>
                        <html:p>To counteract this, Irmin has plenty of <html:code>KV</html:code> modules that provide a <html:code>Make</html:code> functor that only requires a user to provide a suitable <html:em>content</html:em> module for their store (i.e. something that provides a type, a runtime representation of that type and a merge function).</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-mdx-hash">#</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">#</html:span>
                            <html:span class="ocaml-keyword-other">show_module</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Irmin_mem</html:span>
                            <html:span class="ocaml-source">.</html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">KV</html:span>
                            <html:span class="ocaml-source">;;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-keyword-other">module</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">KV</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">sig</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">endpoint</html:span>
                            <html:span class="ocaml-source"> = unit
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">metadata</html:span>
                            <html:span class="ocaml-source"> = unit
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">hash</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">info</html:span>
                            <html:span class="ocaml-source"> = Store.info
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[('h, _)]]></html:span>
                            <html:span class="ocaml-entity-name-function-binding">contents_key</html:span>
                            <html:span class="ocaml-source"> = 'h
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">'h </html:span>
                            <html:span class="ocaml-entity-name-function-binding">node_key</html:span>
                            <html:span class="ocaml-source"> = 'h
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">'h </html:span>
                            <html:span class="ocaml-entity-name-function-binding">commit_key</html:span>
                            <html:span class="ocaml-source"> = 'h
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword-other-ocaml">module</html:span>
                            <html:span class="ocaml-source"><![CDATA[ Make : (C : Irmin__.Contents.S) ->]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml">sig</html:span>
                            <html:span class="ocaml-source"> ... </html:span>
                            <html:span class="ocaml-keyword-other">end</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">end</html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>I think it is fair to say the documentation is hard to follow as it is a module and functor soup. For example, looking at <html:code>irmin.3.11.0</html:code>, starting at <fr:link href="https://ocaml.org/p/irmin/latest/doc/index.html" type="external">the toplevel documentation page</fr:link> our path to finding this paricular module and functor is as follows:</html:p>
                        <html:ol>
                          <html:li>
                            <html:p>We jump into <fr:link href="https://ocaml.org/p/irmin/latest/doc/irmin.mem/Irmin_mem/index.html" type="external"><html:code>Irmin_mem</html:code></fr:link> from the nicely written landing page.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>We scroll down to find <fr:link href="https://ocaml.org/p/irmin/latest/doc/irmin.mem/Irmin_mem/index.html#module-KV" type="external">the KV module</fr:link>.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>We now make sense of the module's signature by following the <fr:link href="https://ocaml.org/p/irmin/latest/doc/irmin/Irmin/module-type-KV_maker/index.html" type="external">KV_maker link</fr:link>.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>We see a <html:code>Make (C : Contents.S) : sig ... end</html:code> at the end of the module, and <fr:link href="https://ocaml.org/p/irmin/latest/doc/irmin/Irmin/module-type-KV_maker/Make/index.html#module-Schema" type="external">we navigate through that</fr:link>.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>Finally we have come to our journey's end, and find the <fr:link href="https://ocaml.org/p/irmin/latest/doc/irmin/Irmin/module-type-KV_maker/Make/index.html#module-Schema" type="external">schema module</fr:link> with type constraints like <html:code>type Branch.t = string</html:code>.</html:p>
                          </html:li>
                        </html:ol>
                        <html:p>There is a big assumption there that you know what the <html:code>Schema</html:code> module is telling you and how it relates to your "store".</html:p>
                        <html:p>There is a counter-argument here, in that Irmin is incredibly flexible in terms of what you can use as types for your keys, branches, hashes etc. I was quite easily able to produce <fr:link href="https://github.com/patricoferris/ocaml-cid/blob/main/test/irmin_cid.ml" type="external">Irmin stores that use CIDs (self-describing content identifiers)</fr:link> for example.</html:p>
                        <html:p>I think there is a middle ground. For Irmin to be usable it needs to reduce the complexity of the API. The complexity is due to, in large part, over-functorisation. If the functors cannot be removed then perhaps better documentation or more <fr:link href="https://ocaml.org/p/irmin-containers/latest/doc/irmin-containers/Irmin_containers/index.html" type="external">introductory libraries like irmin-containers</fr:link> would be helpful. Perhaps a <html:em>standalone</html:em> library that acts as an interface to Irmin stores would be helpful. I find myself time and again implementing <fr:link href="https://github.com/fn06/shelter/blob/main/src/lib/store.ml" type="external">something like that</fr:link>.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Backends Galore">Backends Galore</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Irmin has plenty of backends including <fr:link href="https://ocaml.org/p/irmin-git/latest" type="external">a git-compatible one</fr:link>, <fr:link href="https://ocaml.org/p/irmin-mirage/latest" type="external">a MirageOS backend</fr:link>, <fr:link href="https://ocaml.org/p/irmin-indexeddb/latest" type="external">an in-browser IndexedDB backend</fr:link> and even a <fr:link href="https://github.com/andreas/irmin-fdb" type="external">FoundationDB backend</fr:link>.</html:p>
                        <html:p><fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> needs to have fewer, better tested backends. Of course, some of these are likely driven by funding and use-case specific details. However, I think by focusing on a few key backends and striving for solid performance but also strong consitency guarantees, <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> would become a more viable candidate for potential users. I also believe the browser backend plays a key part to making this work in order to facilate <fr:link href="https://lofi.so/" type="external">local-first applications</fr:link>.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Syncing Remote Stores">Syncing Remote Stores</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>The <fr:link href="https://ocaml.org/p/irmin/3.11.0/doc/irmin/Irmin/Sync/index.html" type="external">synchronisation mechanisms in Irmin</fr:link> are powerful, but often the API is very confusing. For example, with the git-compatible Unix backend, nested deep in the documentation is the function required to create a <fr:link href="https://ocaml.org/p/irmin-git/latest/doc/irmin-git.unix/Irmin_git_unix/Maker/Make/index.html#val-remote" type="external">remote endpoint</fr:link>. Once they have found this function, using it is not easy as it requires them to learn about the <fr:link href="https://ocaml.org/p/mimic/latest" type="external"><html:code>Mimic.ctx</html:code></fr:link>, which is an abstraction of the networking stack!</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Do Fewer Things and Do Them Well">Do Fewer Things and Do Them Well</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Irmin is simultaneously a database that supports: content-addressing, merging, key-value lookup, branches, transactions, complete OS portability etc. I think, in short, it tries to do too many things and comes up short on some of them in ways that really matter.</html:p>
                        <html:p>When building the <fr:link href="https://github.com/carboncredits/retirement-db" type="external">content-addressed database</fr:link> I needed strong guarantees about some atomic actions to perform on the underlying store. For example, <fr:link href="https://github.com/mirage/irmin/issues/2073" type="external">setting the value and accessing the commit associated with it</fr:link> which was not possible with the API at that time in an atomic way. This kind of missing functionality is probably only understood after users stumble across it, but it also makes the library feel less focused and ready for production use-cases.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>8</fr:month>
                      <fr:day>7</fr:day>
                    </fr:date>
                    <fr:title text="Documentation">Documentation</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>It will probably come as no surprise that one of the main limitations of using <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> is the lack of documentation and tutorials. This is a particular pain point as the API is not very straightforward.</html:p>
                    <html:p>A while back, I started an <fr:link href="https://patricoferris.github.io/irmin-book/" type="external">Irmin book</fr:link> intending to help document the kinds of things real-world users would need in order to use <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> in earnest. For example: ways to <fr:link href="https://patricoferris.github.io/irmin-book/contents/versioned-data.html" type="external">deal with type migrations</fr:link> or <fr:link href="https://patricoferris.github.io/irmin-book/arch/runtime-types.html" type="external">primers on runtime types</fr:link>. I still believe this sort of work would be invaluable, but there is a large cost to completing it, and it is not clear if there is enough interest in the project to warrant such an effort.</html:p>
                    <html:p>The <fr:link href="https://irmin.org/tutorial/introduction/" type="external">tutorials on the irmin website</fr:link> are still good starting points for most new users. But they quickly lack the depth for real-world scenarios.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>8</fr:month>
                      <fr:day>7</fr:day>
                    </fr:date>
                    <fr:title text="Feature Wishlist">Feature Wishlist</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>What follows are additional ideas for improving <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>.</html:p>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Heterogeneous Stores">Heterogeneous Stores</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p><![CDATA[For all of [Irmin]'s abstraction and functorisation, there is a very clear]]> missing feature for lots of first-time users of the library: you can only store values of a single type.</html:p>
                        <html:p>This leads to a few common workarounds:</html:p>
                        <html:ul>
                          <html:li>
                            <html:p>Storing a serealised version of your values, essentially escaping the type-system and implementing a form of dynamic typing.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>Growing your value to hold lots of different types via some large variant type.</html:p>
                          </html:li>
                        </html:ul>
                        <html:p>Both of these options are feasible and have been used in practice. However, they are workarounds. A long time ago <fr:link href="https://craigfe.io/" type="external">CraigFe</fr:link> created an <fr:link href="https://github.com/mirage/irmin/issues/909" type="external">RFC for heterogeneous stores</fr:link>, which I think about a lot. The main idea is to augment <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> paths (keys) to be GADTs that carry type information about the kinds of values they access (similar to <fr:link href="https://ocaml.org/p/hmap" type="external">heterogeneuous variants of other data structures</fr:link>). Something like this alongside a simplified API would make Irmin more appealing as a library for persistent data storage.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Real-world Retrospectives">Real-world Retrospectives</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>This echos some thoughts from the <html:em>Documentation</html:em> section. There are some very real-world <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> use-cases out there. For example, for a long time (I'm not sure if this is still the case) parts of the <fr:link href="https://ocaml.org/p/tezos-context/latest#dependencies" type="external">Tezos blockchain were using Irmin</fr:link> which uses the <fr:link href="https://ocaml.org/p/irmin-pack/latest" type="external">irmin-pack</fr:link> backend. Does this make irmin-pack the best tested backend and perhaps should be the default backend for new users? Or is it hyper-specific to the Tezos use case? There are <fr:link href="https://tarides.com/blog/2020-09-01-introducing-irmin-pack/" type="external">blogs on tarides.com about the irmin-pack backend</fr:link>, but they might be outdated and should not be the first place to find advice on which Irmin backend to use.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>8</fr:month>
                          <fr:day>7</fr:day>
                        </fr:date>
                        <fr:title text="Active Development and Engagement">Active Development and Engagement</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>As far as I know, <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> was at the forefront of technologies that have come to be described as <fr:link href="https://lofi.so/" type="external">local-first</fr:link>. There is a growing interest in this area (particularly as it acts as a counter-argument to an increasingly online, centralised model). I highly recommend reading <fr:link href="https://patrick.sirref.org/ink &amp; switch's essay on the matter/" type="external">Ink &amp; Switch's essay on the matter</fr:link>. And it would be great to see more research via <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> at things like <fr:link href="https://lu.ma/localfirstswunconf-stlouis" type="external">the lofi unconference</fr:link> and the <fr:link href="https://2023.splashcon.org/home/plf-2023" type="external">PLF workshop at SPLASH 2023</fr:link>!</html:p>
                        <html:p>Thank you for reading! And thank you to all the <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link> contributors. I hope this might be useful in the future for building the next-generation <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>!</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>23</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/slipshow-x-xocaml/</fr:uri>
                <fr:display-uri>slipshow-x-xocaml</fr:display-uri>
                <fr:route>/slipshow-x-xocaml/</fr:route>
                <fr:title text="Slipshow x x-ocaml">Slipshow x x-ocaml</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>A short, explanatory post about combining two very fun pieces of work in OCaml.</html:p>
                <html:p><fr:link href="https://github.com/panglesd" type="external">Paul-Elliot</fr:link> has been building <fr:link href="https://github.com/panglesd/slipshow" type="external">Slipshow</fr:link> for some time now where slides are <html:em>slips</html:em> and your presentations run vertically. More recently, <fr:link href="/artw/" title="Arthur Wendling" uri="https://patrick.sirref.org/artw/" display-uri="artw" type="local">Arthur</fr:link> has built <fr:link href="https://github.com/art-w/x-ocaml" type="external">x-ocaml</fr:link>, a web component library for executable OCaml cells embedded into OCaml.</html:p>
                <html:p>Using <fr:link href="https://github.com/patricoferris/xocmd" type="external">xocmd</fr:link>, a small tool I built for translating markdown codeblocks to x-ocaml components, your Slipshow's can now be <html:em>executable</html:em>!</html:p>
                <html:pre><![CDATA[xocmd learn-effects.md | slipshow compile - > learn-effects.html]]></html:pre>
                <html:p>
    Take a look at 
    <html:a href="/bafkrmictvc3ap2ah37cbcdoo6rsl7vxqu6srogmgzx6iml45bq7zz5weo4.html">an example</html:a>!
    (or the 
    <html:a href="/bafkrmib3jugpkznxcftqjvhbbtfqgx4oz2m32p5xloh4nxia3lhxy2momq.md">source markdown</html:a>).
</html:p>
                <html:p>I really like this light-weight approach to building interactive presentations for explaining things in OCaml (e.g. over running a jupyter notebook server).</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>7</fr:month>
                  <fr:day>18</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/ocaml-quarterly-q2/</fr:uri>
                <fr:display-uri>ocaml-quarterly-q2</fr:display-uri>
                <fr:route>/ocaml-quarterly-q2/</fr:route>
                <fr:title text="Quarterly OCaml Q2">Quarterly OCaml Q2</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Thanks to <fr:link href="https://patrick.sirref.org/tarides/" type="external">Tarides</fr:link> sponsorship, I get to work on open-source OCaml. This quarterly is a companion to my <fr:link href="/weeklies/" title="Patrick Ferris' Weeklies" uri="https://patrick.sirref.org/weeklies/" display-uri="weeklies" type="local">weeklies</fr:link>, summarising the last three months of development, peppered with ideas and thoughts about OCaml, its community and its future.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="What I wanted to work on?">What I wanted to work on?</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>There were two main things I hoped to <html:em>continue</html:em> working on: <html:strong>ppxlib</html:strong> and <html:strong>outreachy</html:strong>. These are projects that I was previously working on, and in the case of Outreachy I have now been involved for many years.</html:p>
                    <html:p>In addition to this, all of my <fr:link href="/part-ii-2024/" title="Part II Students 2024" uri="https://patrick.sirref.org/part-ii-2024/" display-uri="part-ii-2024" type="local">Part II</fr:link> projects this year used OCaml in some regard. In general, I want to see more adoption of OCaml. Over the years this has taken many forms including <fr:link href="https://ocaml-explore.netlify.app/" type="external">my initial work on developing workflows for OCaml that just turned five years old</fr:link>. This directly fed into the rebranding and rethinking of <fr:link href="https://ocaml.org/" type="external">ocaml.org</fr:link> itself.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="What I worked on?">What I worked on?</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>7</fr:month>
                          <fr:day>18</fr:day>
                        </fr:date>
                        <fr:title text="Ppxlib">Ppxlib</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p><fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> is the de facto standard library for building OCaml preprocessors. At the time of writing, <html:code>opam list --depends-on=ppxlib</html:code> informs me that there are 267 reverse dependencies. <fr:link href="https://www.janestreet.com/" type="external">Janestreet</fr:link> is a heavy user of ppxes and has <fr:link href="https://github.com/orgs/janestreet/repositories?language=&amp;amp;q=ppx&amp;amp;sort=&amp;amp;type=all" type="external">authored many</fr:link>.</html:p>
                        <html:p>One of the main accomplishments this quarter was <fr:link href="/ppxlib-5-2/" title="Bumping Ppxlib's AST to 5.2" uri="https://patrick.sirref.org/ppxlib-5-2/" display-uri="ppxlib-5-2" type="local">bumping the internal AST to 5.2</fr:link>. This allows ppx authors to use new OCaml language features in their ppxes. In bumping the AST, we knowingly broke compatability for pretty much every single reverse dependency. As best we can, we have been sending patches to ppx libraries and helping users migrate to the latest <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>.</html:p>
                        <html:p>There is an interesting dicussion to had about the nature of open-source, and its interaction with industrial monorepos and community tended package repositories. Package ecosystems thrive whenever there is a dedicated community creating, maintaining and publishing packages. The idea is that the published world should be healthy. The publishing medium can act as natural limiting factor in the churn of breaking changes (in the case of OCaml this is via <fr:link href="https://github.com/ocaml/opam-repository/" type="external">PRs to the opam-repository</fr:link>). This, I have come to notice, reacts poorly to changes coming from internally consistent monorepos where introducing breaking changes is easily fixed by applying patches there and then. Whatsmore, OCaml is often stated as an incredibly safe language to perform large refactorings thanks to its type system.</html:p>
                        <html:p><fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> sits awkwardly in the space of possible breaking changes. Tied to OCaml's parsetree, impacts of changes there ripple down to <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>. The compiler itself can remain internally consistent, and is protected as it need only parse source code. <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link>, on the other hand, exposes the parsetree to users and thus any changes to the parsetree will likely be felt by ppx authors. Since I started working on <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>, it feels as though the number of syntax changes has gone up (primarily from Janestreet work). Unless we make changes to how we provide support for these, maintainers of <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> will forever be stuck doing busy work! Thankfully, <fr:link href="/nathanreb/" title="Nathan Rebours" uri="https://patrick.sirref.org/nathanreb/" display-uri="nathanreb" type="local">Nathan</fr:link> <fr:link href="/ocaml-weekly-2025-w29/" title="OCaml Weekly 2025 w29" uri="https://patrick.sirref.org/ocaml-weekly-2025-w29/" display-uri="ocaml-weekly-2025-w29" type="local">has thoughts on how to improve this</fr:link>.</html:p>
                        <html:p>There are a slew of other features I have added to <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> including:</html:p>
                        <html:ul>
                          <html:li>
                            <html:p>Support for deriving from classes.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>Support for deriving from module bindings and signatures.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>Fixing compiler and ppxlib dummy locations.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>Bumping to 5.3.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>Migrations for 5.4.</html:p>
                          </html:li>
                        </html:ul>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>7</fr:month>
                          <fr:day>18</fr:day>
                        </fr:date>
                        <fr:title text="Outreachy">Outreachy</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Our two projects this year, one on <fr:link href="https://github.com/claudiusFX/claudius" type="external">claudius</fr:link> and one on <fr:link href="https://github.com/ocaml/dune" type="external">dune</fr:link>, are going extremely well. At the time of writing, we just had <fr:link href="/ocaml-weekly-2025-w29/" title="OCaml Weekly 2025 w29" uri="https://patrick.sirref.org/ocaml-weekly-2025-w29/" display-uri="ocaml-weekly-2025-w29" type="local">a mid-internship call to catch up</fr:link>, and I was blown away by the progress each intern has made. Unfortunately, <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link> is struggling with funding and the next round is perhaps not going to happen. This is a real shame and I am hoping that it will not be the case.</html:p>
                        <html:p>Outreachy has been a wonderful source of new, committed OCaml developers. If you haven't already, do peruse the <fr:link href="https://ocaml.org/outreachy" type="external">webpage on OCaml.org</fr:link> to see past internships or <fr:link href="https://watch.ocaml.org/c/outreachy_ocaml/videos" type="external">watch the demo day presentations</fr:link>. For the mentors involved, I believe it has also been a rewarding experience (though at times a challenging one). We are always looking for new mentors and project ideas, please <fr:link href="/patrickferris/" title="Patrick Ferris" uri="https://patrick.sirref.org/patrickferris/" display-uri="patrickferris" type="local">do reach out to me</fr:link> if you are interested.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>7</fr:month>
                          <fr:day>18</fr:day>
                        </fr:date>
                        <fr:title text="Hazel">Hazel</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>OCaml's feature set allows it to shine at writing programming languages (and things of that ilk: compilers, interpretters, static analysis tools). <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> is a research programming language with typed holes written completely in OCaml (via the <fr:link href="https://reasonml.github.io/" type="external">reason dialect</fr:link>).</html:p>
                        <html:p>Relating this back to the original intent of my work, to improve OCaml adoption, I believe this also means keeping existing users happy. In the last quarter I developed a compiler from <fr:link href="/hazel_of_ocaml/" title="hazel_of_ocaml" uri="https://patrick.sirref.org/hazel_of_ocaml/" display-uri="hazel_of_ocaml" type="local">OCaml to Hazel</fr:link>. Whilst new features are still being added to <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link>, I hope this could serve as a tool to help develop test-suites and standard library functions using existing OCaml solutions. In a student's work (<fr:link href="/part-ii-hazel/" title="Type Error Debugging in Hazel" uri="https://patrick.sirref.org/part-ii-hazel/" display-uri="part-ii-hazel" type="local">Typed Debugging for Hazel</fr:link>), we used this tool to build a corpus of ill-typed <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> programs to great effect.</html:p>
                        <html:p>OCaml should continue to be a world-class programming language for building other programming languages. I hope to upstream some of this work to <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> and provide some low effort maintenance to help keep their compiler in good shape.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>7</fr:month>
                          <fr:day>18</fr:day>
                        </fr:date>
                        <fr:title text="Systems Programming in OCaml">Systems Programming in OCaml</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>In a cross-over with my own research, I have been developing many tools related to systems programming in OCaml including:</html:p>
                        <html:ul>
                          <html:li>
                            <html:p>An eBPF-based <fr:link href="/open-trace/" title="Opentrace" uri="https://patrick.sirref.org/open-trace/" display-uri="open-trace" type="local"><html:code>open</html:code> syscall tracing tool</fr:link>.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>A library in OCaml for <fr:link href="https://github.com/quantifyearth/void" type="external">spawning void processes</fr:link>.</html:p>
                          </html:li>
                          <html:li>
                            <html:p>A <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">shell session manager</fr:link> that uses <fr:link href="https://irmin.org/" type="external">Irmin</fr:link> to manage sessions. It is nice to see a new push to <fr:link href="https://github.com/mirage/irmin/pull/2149" type="external">finally land the direct-style Irmin PR</fr:link>!</html:p>
                          </html:li>
                        </html:ul>
                        <html:p>This work is means to develop the underlying libraries that support it. For example, I have opened a few PRs to <fr:link href="https://github.com/ocaml-multicore/eio" type="external">Eio</fr:link> to add new "fork actions" to the spawn API. I also investigated the feasibility of changing the underlying mechanisms in <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> to use <fr:link href="https://github.com/ocaml-multicore/picos" type="external">Picos</fr:link>. In the future, I think this could be important avoid further splitting the OCaml ecosystem.</html:p>
                        <fr:tree show-metadata="false" numbered="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                              <fr:month>7</fr:month>
                              <fr:day>18</fr:day>
                            </fr:date>
                            <fr:title text="OxCaml">OxCaml</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>I dabbled a little with <fr:link href="https://oxcaml.org/" type="external">OxCaml</fr:link> and build <fr:link href="/try-oxcaml/" title="Try OxCaml" uri="https://patrick.sirref.org/try-oxcaml/" display-uri="try-oxcaml" type="local">try-oxcaml</fr:link> to let people take it for a spin without having to perform opam repository gymnastics. It turned into a lot of work to track down some pretty inane bugs (type definitions differeing between js_of_ocaml and the OxCaml compiler, resulting in different Javascript runtime representations...).</html:p>
                            <html:p>This unblocked a few of my colleagues to get OxCaml working on tools like <fr:link href="https://jon.recoil.org/notebooks/foundations/foundations1.html" type="external">odoc_notebooks</fr:link> and <fr:link href="https://github.com/art-w/x-ocaml" type="external">x-ocaml</fr:link>.</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>7</fr:month>
                          <fr:day>18</fr:day>
                        </fr:date>
                        <fr:title text="Forester">Forester</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>A good proportion of my work this quarter has been focused on how to present the very work that I am doing. <fr:link href="/jonmsterling/" title="Jon Sterling" uri="https://patrick.sirref.org/jonmsterling/" display-uri="jonmsterling" type="local">Jon Sterling</fr:link> has been developing a tool for scientific thought called <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link> which seemed like a possible candidate for writing and sharing my work.</html:p>
                        <html:p>Porting my existing blog posts and website content from markdown to Forester's LaTeX-inspired syntax didn't seem like an option. In particular, many of my posts made use of additional markdown-based tools (like <fr:link href="https://github.com/realworldocaml/mdx" type="external">ocaml-mdx</fr:link>).</html:p>
                        <html:p>This lead to the development of <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">Graft</fr:link>: a preprocessor for Forester forests, converting markdown and bibtex to trees.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="What's next?">What's next?</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>So, I worked on most of what I wanted to work on and then some! Going forward I hope to keep maintaining <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> in some capacity and coordinating the OCaml community's <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link> efforts.</html:p>
                    <html:p>I hope to continue my small experiments (e.g. converting Eio to Picos). My own research makes heavy use of Irmin, and I would be interested to help with that too. More recently, a new library has been released for working with numerical data in OCaml called <fr:link href="https://github.com/raven-ml/" type="external">Raven</fr:link>: I am interested to use this library in <fr:link href="/geocaml/" title="Geocaml" uri="https://patrick.sirref.org/geocaml/" display-uri="geocaml" type="local">Geocaml</fr:link>, a suite of geospatial tools written in OCaml that I maintain.</html:p>
                    <html:p>I feel conflicted about the <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> efforts. I admit, I am not fully aware of the full benefits of the features, but I worry about some proliferation of modes that make the type system in OCaml unbearable to use. On top of this, with my <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> hat on, I worry about the impact of changing the compiler so frequently, placing strain on an already small community. That being said, by releasing <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> separately I do believe running it as an experimental set of packages will help understand the tool better. But I would not be building anything I intend to maintain or research with right now as that ecosystem is far too volatile.</html:p>
                    <html:p>Finally, over the past two years I have done a lot of teaching. From <fr:link href="/part-ii/" title="Part II Projects" uri="https://patrick.sirref.org/part-ii/" display-uri="part-ii" type="local">Part II projects</fr:link> to <fr:link href="/focs/" title="Foundations of Computer Science" uri="https://patrick.sirref.org/focs/" display-uri="focs" type="local">supervisions</fr:link>. Going into next (academic) year, I intend to reduce my in-person teaching to focus on my research. However, I am interested in producing more materials for learning, maybe some of this in OCaml, perhaps something similar to <fr:link href="https://beautifulracket.com/" type="external">Beautiful Racket</fr:link>. I have tried in the past to do these sorts of things, for example <fr:link href="https://patricoferris.github.io/irmin-book/" type="external">The Irmin Book</fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>7</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="Thank you">Thank you</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Thank you for reading this wrap up! And thank you again to <fr:link href="https://patrick.sirref.org/tarides/" type="external">Tarides</fr:link> for letting me work so freely on things that I think are good for the OCaml community.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>19</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/open-trace/</fr:uri>
                <fr:display-uri>open-trace</fr:display-uri>
                <fr:route>/open-trace/</fr:route>
                <fr:title text="Opentrace">Opentrace</fr:title>
                <fr:meta name="external">https://tangled.sh/@patrick.sirref.org/opentrace</fr:meta>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Thanks to <fr:link href="https://github.com/koonwen/" type="external">Koonwen's</fr:link> excellent <fr:link href="https://github.com/koonwen/ocaml-libbpf" type="external">libbpf bindings in OCaml</fr:link>, I have been building a little tool called <html:code>opentrace</html:code> to make it easier to track an executable's inputs and outputs.</html:p>
                <html:p>This work was inspired my <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael's</fr:link> self-proclaimed "gross hack": <fr:link href="https://github.com/quantifyearth/pyshark" type="external">pyshark</fr:link>. Whilst pyshark achieves its goals by injecting code into commonly used python objects and methods, <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> uses <fr:link href="https://ebpf.io/" type="external">eBPF</fr:link>. By using a lower-level API (hooks in the kernel), <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> can remain programming language agnostic. However, less information is none about the user's intent compared to something like pyshark.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>19</fr:day>
                    </fr:date>
                    <fr:title text="Monitoring the System">Monitoring the System</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> has an <html:code>all</html:code> command that will trace the entire system.</html:p>
                    <html:pre><![CDATA[$ sudo opentrace all --flags=O_WRONLY
pid,cgid,comm,kind,flags,mode,filename,return
16324,4417,".nheko-wrapped",openat,577,438,"/home/patrick/.cache/nheko/nheko/curl_alt_svc_cache.txt",47
16324,4417,".nheko-wrapped",openat,193,33188,"/home/patrick/.cache/nheko/nheko/cr3ZUHqBErIOe3PlwJ1SuU8zFKKxL12VzrRoHYMH.tmp",47
16324,4417,".nheko-wrapped",openat,577,438,"/home/patrick/.cache/nheko/nheko/curl_alt_svc_cache.txt",47
16324,4417,".nheko-wrapped",openat,193,33188,"/home/patrick/.cache/nheko/nheko/QfZTdZSuC56NdcDQ3aMxJc3BhMhAj8PmtYW1zFDP.tmp",47
2530,4235,"systemd",openat,524865,438,"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/gammastep.service/cgroup.subtree_control",41
2530,4235,"systemd",openat,524545,0,"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/gammastep.service/memory.min",41
2530,4235,"systemd",openat,524545,0,"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/gammastep.service/memory.low",41
2530,4235,"systemd",openat,524545,0,"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/gammastep.service/memory.high",41
2530,4235,"systemd",openat,524545,0,"/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/app.slice/gammastep.service/memory.max",41]]></html:pre>
                    <html:p>The <html:code>--flags=O_WRONLY</html:code> argument filters the events where the <html:code>O_WRONLY</html:code> flag was set in the call to <html:code>open</html:code>.</html:p>
                    <html:p>We also get the name of the current executable linked to the task (<html:code>comm</html:code>). The <html:code>-wrapped</html:code> is an artefact of using Nix.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>19</fr:day>
                    </fr:date>
                    <fr:title text="Tracing an Executable">Tracing an Executable</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>The primary use case for this tool is to inspect what files your program might be reading and writing.</html:p>
                    <html:pre><![CDATA[$ sudo opentrace exec --format=json --flags=O_CREAT -- opam list
$ cat trace.json | jq ".[] | .fname"
"/home/patrick/.opam/cshell/.opam-switch/packages/cache"
"/home/patrick/.opam/log/log-118747-29da3d.out"
"/home/patrick/.opam/log/log-118747-29da3d.err"
"/home/patrick/.opam/log/log-118747-29da3d.env"
"/home/patrick/.opam/log/log-118747-29da3d.info"]]></html:pre>
                    <html:p>The "flags" argument can specify a small boolean formula for checking the open flags of a particular event with <html:code>|</html:code> (or), <html:code>&amp;</html:code> (and), and <html:code>~</html:code> (not). Parentheses can be used for precedence.</html:p>
                    <html:pre><![CDATA[$ sudo opentrace exec --flags="O_WRONLY|O_RDONLY" -- ocaml --version]]></html:pre>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>19</fr:day>
                    </fr:date>
                    <fr:title text="Spawning Subprocesses">Spawning Subprocesses</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>One feature <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> needs (in this proof-of-concept phase) is the ability to also trace subprocesses.</html:p>
                    <html:p><fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> is primarily an eBPF program that is loaded into the kernel and communicates with an OCaml program. Events are communicated via a ring buffer and most of the post-processing happens in OCaml. To capture subprocesses, <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> creates a new control group (cgroup) and places the new process into that group. This gives <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> a new identifier to track, namely the cgroup.</html:p>
                    <html:p>So consider the following program.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Eio_posix</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">run</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">@@</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">env</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Eio</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Path</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">save</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">create</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-polymorphic-variant">`Or_truncate</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-octal-integer">0o664</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">env</html:span>
                        <html:span class="ocaml-keyword-other">#</html:span>
                        <html:span class="ocaml-source">fs</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">/</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">hello.txt</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">hello</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Eio</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Process</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">run</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">env</html:span>
                        <html:span class="ocaml-keyword-other">#</html:span>
                        <html:span class="ocaml-source">process_mgr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">/bin/bash</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">-c</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">echo 'heya' &gt; heya.txt</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>It first creates a file using direct calls to functions like <html:code>openat</html:code>. Then it spawns a process which creates a new file called <html:code>heya.txt</html:code>. This happens in a separate process. However, with the <html:code>--cgroups</html:code> flag we can capture both interactions with the operating system.</html:p>
                    <html:pre><![CDATA[$ sudo opentrace exec --cgroups --flags="O_CREAT|O_TRUNC" ./main.exe
pid,cgid,comm,kind,flags,mode,filename,return
153187,530807,"main.exe",openat,526914,436,"hello.txt",5
153192,530807,"bash",openat,577,438,"heya.txt",3]]></html:pre>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>5</fr:month>
                          <fr:day>19</fr:day>
                        </fr:date>
                        <fr:title text="Eio's Process API">Eio's Process API</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>I have used the <html:code>Eio_unix</html:code> <fr:link href="https://ocaml.org/p/eio/latest/doc/Eio_unix/Process/index.html" type="external">fork action process API</fr:link> to be able to extend what happens in the child process. Loading most eBPF programs into the kernel requires special privileges hence the need for <html:code>sudo</html:code>. When a user requests for a particular program to be executed and traced, <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> spawns a process via the Eio Process API. <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">Opentrace</fr:link> defines a few new so-called "fork actions", little fragments of C code that are run after the call to <html:code>fork</html:code> (<html:code>clone</html:code>). Most likely this ends with a call to <html:code>execve</html:code>, but other calls are possible for example <html:code>setuid</html:code> allowing <fr:link href="/opentrace/" title="Opentrace" uri="https://patrick.sirref.org/opentrace/" display-uri="opentrace" type="local">opentrace</fr:link> to change the user of the child process so it does not run as <html:code>root</html:code>. Similarly, this is where (if used) we create the cgroup and place the process into that group.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>19</fr:day>
                    </fr:date>
                    <fr:title text="Limitations: Io_uring">Limitations: Io_uring</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Whilst testing <html:code>opentrace</html:code> against some of the tools I use nearly daily, I noticed some events were being missed. I tried tracing <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link>, and only the initial read of <html:code>forest.toml</html:code> was logged. It dawned on me that the reason for this was that <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link> (via <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">eio</fr:link>) was using <fr:link href="https://patrick.sirref.org/io_uring/" type="external">io_uring</fr:link> to perform most of the IO. Most attempts to open files were bypassing the open system calls, and instead they were being performed by the kernel after reading a submission request for an <html:code>openat2</html:code>-style call!</html:p>
                    <html:p>This is not news to seasoned, Linux systems programmers. Io_uring <fr:link href="https://blog.0x74696d.com/posts/iouring-and-seccomp/" type="external">bypasses <html:code>SECCOMP</html:code> filters</fr:link> for exactly the same reasons.</html:p>
                    <html:pre><![CDATA[$ sudo opentrace exec -- forester build
$ cat trace.csv
pid,cgid,comm,kind,flags,mode,filename,return
155007,535570,"forester",openat,524288,0,"forest.toml",5
155007,535570,"forester",Uring,2621440,0,"",0
155021,535570,"cp",openat,131072,0,"/home/patrick/documents/forest/theme/favicon-32x32.png",4
155007,535570,"forester",Uring,2686976,0,"",0
155007,535570,"iou-wrk-155007",Uring,557634,420,"",0
155007,535570,"iou-wrk-155007",Uring,557634,420,"",0
155007,535570,"iou-wrk-155007",Uring,557634,420,"",0]]></html:pre>
                    <html:p>It is interesting to note two things here:</html:p>
                    <html:ol>
                      <html:li>
                        <html:p>We can tell that <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link> reads the configuration file probably using something like <html:code>In_channel</html:code> in OCaml (<fr:link href="https://git.sr.ht/~jonsterling/ocaml-forester/tree/7f275290e211db2590b0d715d8fb47fc1de36550/item/lib/frontend/Config.ml#L22" type="external">it does</fr:link>).</html:p>
                      </html:li>
                      <html:li>
                        <html:p>It appears that Uring is performing IO in both worker threads and directly.</html:p>
                      </html:li>
                    </html:ol>
                    <html:p>The file paths are empty at the moment as I cannot find a clean way to trace openat submission requests into Uring without it sometimes going very wrong. I have tried quite a few methods (e.g. tracing <html:code>do_filp_open</html:code>) and at the moment I am tracing <html:code>io_openat2</html:code>, but this seems quite brittle, and often the filename is completely garbled, so I do not set it. If anyone has any ideas to trace Io_uring more reliably, I am all ears!</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>9</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/try-oxcaml/</fr:uri>
                <fr:display-uri>try-oxcaml</fr:display-uri>
                <fr:route>/try-oxcaml/</fr:route>
                <fr:title text="Try OxCaml">Try OxCaml</fr:title>
                <fr:meta name="external">https://patrick.sirref.org/oxcaml</fr:meta>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>This week, I have been trying out Janestreet's <fr:link href="https://blog.janestreet.com/oxidizing-ocaml-locality/" type="external">Oxidised OCaml</fr:link> (see their <fr:link href="/oxcaml-2024/" title="Oxidizing OCaml with Modal Memory Management" uri="https://patrick.sirref.org/oxcaml-2024/" display-uri="oxcaml-2024" type="local">ICFP paper</fr:link>). This adds a system of <html:em>modes</html:em> to OCaml for expressing things like locality.</html:p>
                <html:blockquote>
                  <html:p>...we’re introducing a system of modes, which track properties like the locality and uniqueness of OCaml values. Modes allow the compiler to emit better, lower-allocation code, empower users to write safer APIs, and with the advent of multicore, statically guarantee data race freedom—all in a lightweight way that only affects those in need.</html:p>
                </html:blockquote>
                <html:p>For example, you might say:</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-keyword">let</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-entity-name-function-binding">is_empty</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-source">s</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-support-type">string</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">@@</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">local</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">String</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">length</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">s</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <html:p>To get a feel for how this changes the language, you can follow their <fr:link href="https://github.com/janestreet/opam-repository/tree/with-extensions" type="external">instructions on their custom opam-repository</fr:link>. Alternatively, you can <fr:link href="https://patrick.sirref.org/oxcaml" type="external">give it a go in your browser</fr:link>! This is a full toplevel running with <html:code>Base</html:code> installed (which has plenty of OxCaml annotations on Stdlib-like functions).</html:p>
                <html:p>Happy OxCamling!</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/hazel-of-ocaml/</fr:uri>
                <fr:display-uri>hazel-of-ocaml</fr:display-uri>
                <fr:route>/hazel-of-ocaml/</fr:route>
                <fr:title text="A Transpiler from OCaml to Hazel">A Transpiler from OCaml to Hazel</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Over the past few months, I have been piecing together a transpiler from <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> to OCaml. This is, in part, to help one of my third-year undergraduate students who is working on <fr:link href="/part-ii-hazel/" title="Type Error Debugging in Hazel" uri="https://patrick.sirref.org/part-ii-hazel/" display-uri="part-ii-hazel" type="local">type error debugging in Hazel</fr:link>.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="Typed Holes">Typed Holes</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> is a <fr:link href="/omar-hazel-2017/" title="Hazelnut: a bidirectionally typed structure editor calculus" uri="https://patrick.sirref.org/omar-hazel-2017/" display-uri="omar-hazel-2017" type="local">functional programming language with typed holes</fr:link>. Holes are pieces of your program that have not yet been filled in. Holes can appear anywhere in your program both as expression or types. Hazel can still evaluate your program in the presence of holes.</html:p>
                    <html:p>To get a flavour of Hazel, take a regular map function for lists.</html:p>
                    <html:pre><![CDATA[let map = fun f -> fun xs -> case xs
  | [] => []
  | x :: xs => f (x) :: map(f)(xs) 
end in
map(fun x -> ?)([1, 2, 3])]]></html:pre>
                    <html:p>The question mark (<html:code>?</html:code>) is a hole. The program evaluates to the following expression of type <html:code><![CDATA[[?]]]></html:code> (for people more familiar with OCaml types <html:code>? list</html:code>).</html:p>
                    <html:pre><![CDATA[[ ?, ?, ? ]]]></html:pre>
                    <html:p>Hazel supports <fr:link href="/zhao-typeerror-2024/" title="Total Type Error Localization and Recovery with Holes" uri="https://patrick.sirref.org/zhao-typeerror-2024/" display-uri="zhao-typeerror-2024" type="local">local type inference</fr:link> but nothing involving unification variables. For example, a simple <html:code>add_one</html:code> function in <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> (<html:code>fun x -&gt; x + 1</html:code>) has type <html:code>? -&gt; Int</html:code>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="From OCaml to Hazel">From OCaml to Hazel</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>The ability to transpile OCaml programs to Hazel programs is motivated by one simple thought: there are more OCaml programs than there are Hazel programs. This could help bootstrap projects by alleviating the need to rewrite boilerplate code (e.g. URI parsing or standard library functions for strings).</html:p>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>5</fr:month>
                          <fr:day>2</fr:day>
                        </fr:date>
                        <fr:title text="A Transformation of Syntax">A Transformation of Syntax</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Hazel markets itself as an "Elm/ML-like functional programming language". From the previous example of <html:code>map</html:code>, it should be apparent just how close to OCaml the language is.</html:p>
                        <html:p>It turns out that a majority of the transpiler is a <html:em>transformation of syntax</html:em>. Take a simple ADT for an arithmetic programming language.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-keyword-other">type</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Float</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">of</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-support-type">float</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Add</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">of</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">*</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Sub</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">of</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">*</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Mul</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">of</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">*</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Div</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">of</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">*</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">expr</html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>And when we run <fr:link href="/hazel_of_ocaml/" title="hazel_of_ocaml" uri="https://patrick.sirref.org/hazel_of_ocaml/" display-uri="hazel_of_ocaml" type="local">hazel_of_ocaml</fr:link> over this OCaml type declaration.</html:p>
                        <html:pre><![CDATA[type expr =
  + Float(Float)
  + Add((expr, expr))
  + Sub((expr, expr))
  + Mul((expr, expr))
  + Div((expr, expr))
 in ?]]></html:pre>
                        <html:p>Not much has changed expect some syntax. <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> does not have a notion of top-level expression so <fr:link href="/hazel_of_ocaml/" title="hazel_of_ocaml" uri="https://patrick.sirref.org/hazel_of_ocaml/" display-uri="hazel_of_ocaml" type="local">hazel_of_ocaml</fr:link> wraps the program into one set of value bindings. For the most part, Hazel acts as a subset of the pure, functional part of OCaml. At the time of writing, this subset is fairly limited with no support for modules or labelled records out of the box (there are plenty of development branches with these features).</html:p>
                        <html:p>If we try out the same <html:code>map</html:code> function but written in OCaml and transpiled to Hazel we get.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword">rec </html:span>
                            <html:span class="ocaml-entity-name-function-binding">map</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">f</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">function</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">x</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">xs</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">f</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">x</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">map</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">f</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">xs</html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>Which becomes the following hazel program.</html:p>
                        <html:pre><![CDATA[let map = fun f -> fun x1 -> case x1
  | [] => []
  | x :: xs => f(x) :: map(f)(xs)
end in ?]]></html:pre>
                        <html:p>We could have a field day discussing the syntax of OCaml and Hazel (parentheses for function arguments, well-scoped cases for pattern-matching, a different arrow for pattern-matching etc.). What would be more interesting is taking a look at how to handle polymorphism in Hazel.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>5</fr:month>
                          <fr:day>2</fr:day>
                        </fr:date>
                        <fr:title text="Explicit Polymorphism">Explicit Polymorphism</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Hazel has <html:em>explicit polymorphism</html:em>. So far, we have not seen it as we have let the types have holes in them. The <html:code>map</html:code> function in OCaml has the following type.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-keyword-other">val</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">map</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> 
</html:span>
                            <html:span class="ocaml-source">  </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-storage-type">'a</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-storage-type">'b</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-storage-type">'a</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">list</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-storage-type">'b</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">list</html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>We must remind ourselves (by reading <fr:link href="https://www.craigfe.io/posts/polymorphic-type-constraints" type="external">Craig's excellent blogpost on the matter</fr:link>) that in OCaml</html:p>
                        <html:blockquote>
                          <html:p>... type variables in signatures are implicitly universally-quantified</html:p>
                        </html:blockquote>
                        <html:p>So in reality, we have that <html:code>map</html:code> has the following type.</html:p>
                        <html:pre><![CDATA[val map : ∀ a b. (a ->  b) -> a list -> b list]]></html:pre>
                        <html:p>In Hazel, we have to explicitly type our <html:code>map</html:code> function to be polymorphic. Not only does this mean the type annotation requires universally quantified type variables, but we must also perform type application wherever we choose to apply the <html:code>map</html:code> function (whether that be recursively or somewhere later in our program).</html:p>
                        <html:pre><![CDATA[let map : forall a -> forall b -> (a -> b) -> [a] -> [b] =
  typfun a -> typfun b -> fun f -> fun xs -> case xs
    | [] => []
    | x :: xs => f (x) :: map@<a>@<b>(f)(xs) 
end in
map@<Int>@<Int>(fun x -> ?)([1, 2, 3])]]></html:pre>
                        <html:p><html:code>forall</html:code> introduces a universally quantified type variable into our type annotation, and <html:code>typfun</html:code> introduces it into the function itself (à la System F). Type application requires <html:code>@&lt;T&gt;</html:code> where <html:code>T</html:code> is some type. This allows hazel to quite easily support higher rank polymorphism, but we will not worry too much about that.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                          <fr:month>5</fr:month>
                          <fr:day>2</fr:day>
                        </fr:date>
                        <fr:title text="Propagating OCaml Types into Hazel">Propagating OCaml Types into Hazel</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>Most often, OCaml users interact with <html:em>prenex</html:em> polymorphism (rank-1) where the universal quantifiers are at the front of the type. <fr:link href="https://ocaml.org/manual/5.2/polymorphism.html#s:higher-rank-poly" type="external">OCaml does support quantifiers inside certain types like records</fr:link>.</html:p>
                        <html:p>What this means for the transpiler is that we can <html:strong>reuse OCaml's type inference</html:strong> to safely instantiate the correct type annotations and type applications in Hazel! To do this, <html:code>hazel_of_ocaml</html:code> uses <fr:link href="https://ocaml.github.io/merlin/" type="external">Merlin</fr:link> to inspect the type of the function in either a value binding or at the point of a function application.</html:p>
                        <html:p>Take a simple, polymorphic <html:code>length</html:code> function.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword">rec </html:span>
                            <html:span class="ocaml-entity-name-function-binding">length</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">function</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">|</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language">_</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">xs</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">+</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">length</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">xs</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">int_len</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">length</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">2</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">3</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">str_len</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">length</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-string-quoted-double">"</html:span>
                            <html:span class="ocaml-string-quoted-double">only</html:span>
                            <html:span class="ocaml-string-quoted-double">"</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-string-quoted-double">"</html:span>
                            <html:span class="ocaml-string-quoted-double">two</html:span>
                            <html:span class="ocaml-string-quoted-double">"</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>When we run this through <html:code>hazel_of_ocaml</html:code> with the <html:code>-type</html:code> flag we get.</html:p>
                        <html:pre><![CDATA[let length : forall a -> [a] -> Int = typfun a -> fun x1 -> case x1
  | [] => 0
  | _ :: xs => 1 + length@<a>(xs)
end in
let int_len : Int = length@<Int>(1 :: 2 :: [3]) in
let str_len : Int = length@<String>("only" :: ["two"])
in ?]]></html:pre>
                        <html:p><html:code>hazel_of_ocaml</html:code> has correctly instantiated the type for <html:code>length</html:code> inside the recursive function and then in each case with the integer list and the string list.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="A Corpus of Hazel Programs">A Corpus of Hazel Programs</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>The impetus for this work was to derive a corpus of ill-typed Hazel programs. Luckily, such a corpus exists for OCaml! <fr:link href="/ocaml-corpus/" title="A Collection of Novice Interactions with the OCaml Top-Level System" uri="https://patrick.sirref.org/ocaml-corpus/" display-uri="ocaml-corpus" type="local">Seidel et al.</fr:link> created a corpus of OCaml programs from their undergraduate students at UC San Diego. <fr:link href="https://github.com/patricoferris/hazel-corpus" type="external">Some of these programs have been transpiled to Hazel</fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="Future Work">Future Work</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> is a fun, research programming language. Potential third-year students may find it interesting to take this work further. For example, how would this look in terms of a module system? From a purely engineering perspective, plenty of work would be needed to convert a multi-library OCaml project to Hazel (e.g. handling the <html:code>cmi</html:code> files).</html:p>
                    <html:p>Another line of research would be to have Hazel target one of the intermediate representations in OCaml which would give Hazel a fully functioning compiler to "native" code?</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>2</fr:month>
                  <fr:day>18</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/ppxlib-5-2/</fr:uri>
                <fr:display-uri>ppxlib-5-2</fr:display-uri>
                <fr:route>/ppxlib-5-2/</fr:route>
                <fr:title text="Bumping Ppxlib's AST to 5.2">Bumping Ppxlib's AST to 5.2</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> is a libary for building OCaml preprocessors. Users can generate OCaml code <html:em>from</html:em> OCaml code (derivers) or replace parts of OCaml code with other OCaml code (rewriters).</html:p>
                <html:p>At the core of <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> is the OCaml parsetree; a data structure in the compiler that represents OCaml source code. <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> makes a distinction between the source parsetree (based on the version of the OCaml compiler you are using) and <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>'s parsetree (a copy of <html:em>some</html:em> parsetree from the compiler).</html:p>
                <html:p>In <fr:link href="https://discuss.ocaml.org/t/ann-ppxlib-0-36-0" type="external">ppxlib.0.36.0</fr:link>, the internal AST was bumped from the AST of OCaml 4.14.0, to the AST of OCaml 5.2.0. This post discusses some of the internal mechanisms that allows ppxlib to support multiple compilers and how this bump broke a lot of backwards compatibility.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="Manual Migrations in Ppxlib">Manual Migrations in Ppxlib</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>It is possible to perform migrations between parsetrees manually using the <html:code>ppxlib.ast</html:code> package.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">open</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppxlib</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">open</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ast_builder</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">struct</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Location</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">none</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">end</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">pp_expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Format</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">printf</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-constant-character-printf"><![CDATA[%a]]></html:span>
                        <html:span class="ocaml-constant-character-printf"><![CDATA[%!]]></html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pp_ast</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">expression</html:span>
                        <html:span class="ocaml-source"> ?</html:span>
                        <html:span class="ocaml-source">config</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Location</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">none</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">str</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">txt</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">txt</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">To_408</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppxlib_ast</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Convert</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppxlib_ast</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Js</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppxlib_ast__</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Versions</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">OCaml_408</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>The <html:code>Ppxlib_ast.Js</html:code> module is <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>'s AST (since <html:code>ppxlib.0.36.0</html:code> OCaml 5.2.0). We can use functions provided by the <html:code>Convert</html:code> functor to copy parts of the AST from one version to another. Usually there is very little difference between the versioned parsetrees.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">func</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">arg</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">body</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source">pexp_fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">str</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">arg</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">body</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">add_expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">func</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">func</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">eapply</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">evar</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">Int.add</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">evar</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">evar</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>The above excerpt of OCaml code produces an expression in the language. More accurately, a function that has two arguments. If we print the simplified AST we can see that the arguments are stored together in a list.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pp_expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">add_expr</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">__loc</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_desc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pparam_val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">__loc</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_desc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pparam_val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pfunction_body</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_apply</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ldot</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">Int</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">add</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">           </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">           </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">unit</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>This is a relatively new feature of the parsetree, if we migrate the expression down to <html:code>4.08</html:code> we see it is represented differently. The output is a little too verbose to be readable, and there's no good way to show the AST, so you will just have to take my word.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">expr_408</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">To_408</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">copy_expression</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">add_expr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="Function Arity in the OCaml Parsetree">Function Arity in the OCaml Parsetree</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>OCaml 5.2 introduced a new way to represent functions. Before 5.2, all functions were represented with single arity. Functions with multiple arguments would return functions as their body. For example:</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">add</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">+</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>A two-argument <html:code>add</html:code> function would be represented in the parsetree as <html:code>fun x -&gt; fun y -&gt; x + y</html:code>. Using the nodes from the parsetree (with some details removed) it would be <html:code>Pexp_fun (x, Pexp_fun (y, Pexp_apply ...))</html:code>.</html:p>
                    <html:p>Now, since OCaml 5.2, functions can be expressed with their syntactic arity intact. The function <html:code>add</html:code> would look something like <html:code><![CDATA[Pexp_function ([ x; y ], Pfunction_body (Pexp_apply ...))]]></html:code>. Both arguments are stored as a list.</html:p>
                    <html:p>The constructor <html:code>Pexp_function</html:code> was not a new addition to the parsetree. It used to represent pattern-matching expressions like <html:code>function A -&gt; 1</html:code>. This can now be expressed as a function body of <html:code>Pfunction_cases</html:code>.</html:p>
                    <html:p>Whilst these additions and modifications to the parsetree are arguably a better design, it has caused chaos in terms of <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>'s reverse dependencies!</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="Coalescing Function Arguments">Coalescing Function Arguments</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>In <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> <html:code>0.36.0</html:code>, functions from <html:code>Ast_builder</html:code> will help ppx authors produce maximum arity functions. However, functions from <html:code>Ast_helper</html:code> will not do this.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">ast_helper_func</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">arg</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">body</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ast_helper</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Exp</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">fun_</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">str</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">arg</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">body</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">ast_helper_expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">ast_helper_func</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">ast_helper_func</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">eapply</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">evar</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">Int.equal</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">evar</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">evar</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Here we recreate our helper function to create function expressions using <html:code>Ast_helper.Exp.fun_</html:code> instead. We can now show the difference between the <html:code>expr</html:code> expression and the <html:code>ast_helper_expr</html:code> expression.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pp_expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">add_expr</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">__loc</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_desc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pparam_val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">__loc</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_desc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pparam_val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pfunction_body</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_apply</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ldot</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">Int</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">add</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">           </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">           </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">unit</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Above, we see a function expression with arity <html:em>two</html:em>. Below, we see nested function expressions each with arity <html:em>one</html:em>.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-mdx-hash">#</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pp_expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">ast_helper_expr</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">__loc</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_desc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pparam_val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pfunction_body</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">      </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_loc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">__loc</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">             </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">pparam_desc</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pparam_val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ppat_var</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">             </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">           </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">None</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pfunction_body</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">             </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_apply</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">                </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Ldot</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">Int</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">equal</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">                </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">x</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">                  </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Nolabel</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Pexp_ident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lident</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">y</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">                  </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">                </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">         </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-operator">-</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">unit</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="Ramifications for Ppxlib Users">Ramifications for Ppxlib Users</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Many, many, <html:em>many</html:em> ppxes broke after migrating the <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> AST to 5.2. Mostly, this is due to pattern-matching. Downstream users of <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> frequently pattern-match directly against the parsetree. However, nodes such as <html:code>Pexp_fun</html:code> no longer exist and <html:code>Pexp_function</html:code> has completely different constructor arguments!</html:p>
                    <html:p>Patching all the ppxes has been quite difficult. Most ppxes only deal with single arguments at a time (e.g. <html:code>Pexp_fun x</html:code>) but now they must handle zero or more arguments at a time. (In the zero case, this will always correspond to a pattern-matching <html:code>function</html:code>).</html:p>
                    <html:p>Here is a non-exhaustive list of some of the ppxes that have been patched. It may useful for other ppx authors who wish to upgrade to <html:code>ppxlib.0.36.0</html:code>:</html:p>
                    <html:ul>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/patricoferris/ppx_deriving_yaml/pull/58" type="external">https://github.com/patricoferris/ppx_deriving_yaml/pull/58</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/mirage/ocaml-rpc/pull/181" type="external">https://github.com/mirage/ocaml-rpc/pull/181</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://gitlab.com/o-labs/ppx_deriving_jsoo/-/merge_requests/1" type="external">https://gitlab.com/o-labs/ppx_deriving_jsoo/-/merge_requests/1</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/ocaml-community/sedlex/pull/160" type="external">https://github.com/ocaml-community/sedlex/pull/160</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/ocaml-sys/config.ml/pull/22" type="external">https://github.com/ocaml-sys/config.ml/pull/22</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/vogler/ppx_distr_guards/pull/2" type="external">https://github.com/vogler/ppx_distr_guards/pull/2</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/ocaml-gospel/gospel/pull/424" type="external">https://github.com/ocaml-gospel/gospel/pull/424</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/teamwalnut/graphql-ppx/pull/299" type="external">https://github.com/teamwalnut/graphql-ppx/pull/299</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/ocsigen/lwt/pull/1033" type="external">https://github.com/ocsigen/lwt/pull/1033</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://gitlab.com/gopiandcode/ppx-inline-alcotest/-/merge_requests/3" type="external">https://gitlab.com/gopiandcode/ppx-inline-alcotest/-/merge_requests/3</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/dariusf/ppx_interact/pull/3" type="external">https://github.com/dariusf/ppx_interact/pull/3</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/ocaml-ppx/ppx_deriving_yojson/pull/160" type="external">https://github.com/ocaml-ppx/ppx_deriving_yojson/pull/160</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/lpcic/elpi/pull/276" type="external">https://github.com/LPCIC/elpi/pull/276</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/mirage/repr/pull/110" type="external">https://github.com/mirage/repr/pull/110</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/programingisthefuture/ppx_default/pull/3" type="external">https://github.com/ProgramingIsTheFuture/ppx_default/pull/3</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/codinuum/vlt/pull/3" type="external">https://github.com/codinuum/vlt/pull/3</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/sim642/ppx_deriving_hash/pull/6" type="external">https://github.com/sim642/ppx_deriving_hash/pull/6</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/ocsigen/tyxml/pull/340" type="external">https://github.com/ocsigen/tyxml/pull/340</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/sim642/ppx_viewpattern/pull/2" type="external">https://github.com/sim642/ppx_viewpattern/pull/2</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/little-arhat/ppx_jsobject_conv/pull/11" type="external">https://github.com/little-arhat/ppx_jsobject_conv/pull/11</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/robur-coop/lun/pull/1" type="external">https://github.com/robur-coop/lun/pull/1</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://gitlab.com/o-labs/ppx_deriving_encoding/-/merge_requests/4" type="external">https://gitlab.com/o-labs/ppx_deriving_encoding/-/merge_requests/4</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/francoisthire/bam/pull/12" type="external">https://github.com/francoisthire/bam/pull/12</fr:link>
                        </html:p>
                      </html:li>
                      <html:li>
                        <html:p>
                          <fr:link href="https://github.com/xguerin/bitstring/pull/36" type="external">https://github.com/xguerin/bitstring/pull/36</fr:link>
                        </html:p>
                      </html:li>
                    </html:ul>
                    <html:p>This release has emphasised the tension between using pattern-matching on algebraic datatypes and wanting to reduce downstream breakages (e.g. using abstract datatypes). This <fr:link href="https://www.cambridge.org/core/journals/journal-of-functional-programming/article/pattern-matching-with-abstract-data-types1/04DD26A0E6CA3A1E87E0E6AE8BC02EED" type="external">tension is not new</fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>18</fr:day>
                    </fr:date>
                    <fr:title text="The Future of Ppxlib">The Future of Ppxlib</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> is not going anywhere anytime soon. We have committed to trying to keep the internal AST up to date with the latest OCaml release. In fact, there is already a PR for <fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/558" type="external">the 5.3 bump</fr:link>!</html:p>
                    <html:p>There have been many discussions about simplifying this process, but so far the time and effort to build a <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> that will result in fewer breakages is too high (see <fr:link href="https://github.com/ocaml-ppx/ppx" type="external">an attempt using views</fr:link>).</html:p>
                    <html:p>Thank you to Tarides and Jane Street for funding my time to work on this release and all the chaos it has caused.</html:p>
                    <html:p>Happy preprocessing!</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>2</fr:month>
                  <fr:day>28</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/vpnkit-upgrade/</fr:uri>
                <fr:display-uri>vpnkit-upgrade</fr:display-uri>
                <fr:route>/vpnkit-upgrade/</fr:route>
                <fr:title text="Defunctorising VPNKit">Defunctorising VPNKit</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/vpnkit/" title="VPNKit" uri="https://patrick.sirref.org/vpnkit/" display-uri="vpnkit" type="local">VPNKit</fr:link> is a core part of the Docker for Mac/Windows stack. It is tasked with translating network activity from the host to the Linux container.</html:p>
                <html:p>This short post discusses some of the recent changes to MirageOS and how they impact <fr:link href="/vpnkit/" title="VPNKit" uri="https://patrick.sirref.org/vpnkit/" display-uri="vpnkit" type="local">VPNKit</fr:link>.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:uri>https://patrick.sirref.org/dune-virt-libs/</fr:uri>
                    <fr:display-uri>dune-virt-libs</fr:display-uri>
                    <fr:route>/dune-virt-libs/</fr:route>
                    <fr:title text="Dune Virtual Libraries">Dune Virtual Libraries</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Dune, for quite some time, has supported <html:em>virtual libraries</html:em>. This allows library authors to define a signature without an implementation (similar to OCaml's <html:code>module type S = struct ... end</html:code>). The package is something other dune libraries can build against, still without choosing a particular implementation of the interface. An application author can make the decision about which implementation they would like to build into their program.</html:p>
                    <html:p>This feature has been quite widely used in OCaml. For example, the <fr:link href="https://github.com/mirage/digestif" type="external">excellent <html:code>digestif</html:code> library</fr:link> of hashing algorithms provides both C and OCaml implementations individually packaged into <html:code>digestif.c</html:code> and <html:code>digestif.ocaml</html:code> respectively. Consider developing a browser application that needs some hashing algorithm (e.g. <fr:link href="https://github.com/patricoferris/omditor" type="external">Irmin in the browser</fr:link>). We can explicitly use the OCaml backend for digestif which <fr:link href="https://github.com/ocsigen/js_of_ocaml" type="external">js_of_ocaml</fr:link> will happily compile for us.</html:p>
                    <html:p>There are two distinct limitations to this approach.</html:p>
                    <html:ol>
                      <html:li>
                        <html:p>Applications can only link <html:em>exactly one</html:em> implementation.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>Implementations cannot expose additional functionality easily (see <fr:link href="https://github.com/ocaml/dune/issues/5997" type="external">dune#5597</fr:link>).</html:p>
                      </html:li>
                    </html:ol>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>28</fr:day>
                    </fr:date>
                    <fr:title text="Functors in MirageOS">Functors in MirageOS</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="https://mirage.io/" type="external">MirageOS</fr:link> is a framework for building unikernels in OCaml. It relies heavily on OCaml's functors to abstract implementation from interface. The mirage tool will then select appropriate instantiations of these functors depending on the backend that is targeted (e.g. <html:code>unix</html:code>, <html:code>hvt</html:code> etc.)</html:p>
                    <html:p>Recently, <fr:link href="https://github.com/mirage/mirage-skeleton/pull/407/" type="external">there has been a push</fr:link> to use <fr:link href="/dune-virt-libs/" title="Dune Virtual Libraries" uri="https://patrick.sirref.org/dune-virt-libs/" display-uri="dune-virt-libs" type="local">dune virtual libraries</fr:link> instead.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>28</fr:day>
                    </fr:date>
                    <fr:title text="VPNKit's Fake Clock &amp; Time">VPNKit's Fake Clock &amp; Time</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>We need to be able to overcome the limitation that implementations cannot expose additional functionality very easily using dune virtual libraries. As it stands, we need to make Mirage's virtual libraries unwrapped (i.e. set <html:code>(wrapped false)</html:code>). This allows implementers to expose additional modules alongside the implementation of the virtual library.</html:p>
                    <html:p>For VPNkit, we need this to port some of the DNS forwarding tests which use a fake clock and sleep module. Previously, they could be provided directly as functor arguments to the various DNS modules e.g.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Dns_forward</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Resolver</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Proto_client</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Fake</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Time</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Fake</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Clock</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>In this new world of <fr:link href="/dune-virt-libs/" title="Dune Virtual Libraries" uri="https://patrick.sirref.org/dune-virt-libs/" display-uri="dune-virt-libs" type="local">dune virtual libraries</fr:link>, our <html:code>Resolver</html:code> is significantly more simple.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Dns_forward</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Resolver</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Proto_client</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>The flexibility of time and clock implementation has been pushed to a build-time decision in a dune file. This means that in order to provide the same fake clock and time we will need to create a private dune library that (a) implements the respective signatures of the virtual libraries and (b) provides the extended interface to allow the test suite to modify the internals of the implementations.</html:p>
                    <html:p>The first thing I had to do was make the <html:code>mirage-mtime</html:code> and <html:code>mirage-sleep</html:code> virtual libraries unwrapped. This allowed me to make a new private dune library called <html:code>fake_time</html:code> with <html:em>two</html:em> public modules: the normal interface required by <html:code>mirage-mtime</html:code> and another module called <html:code>Fake_time_state</html:code> containing:</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">timeofday</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">ref</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">0L</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">c</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lwt_condition</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">create</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">advance</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">nsecs</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source">timeofday</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Int64</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">add</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">!</html:span>
                        <html:span class="ocaml-source">timeofday</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">nsecs</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lwt_condition</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">broadcast</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">c</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">reset</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source">timeofday</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">0L</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Lwt_condition</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">broadcast</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">c</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>I did the same for <html:code>fake_sleep</html:code> which depended on the state from the <html:code>fake_time</html:code> library (something a normal library wouldn't).</html:p>
                    <html:p>Once I had the implementations for the virtual libraries in place, all that remained was to tell the executable (in this case the test suite) to select these new implementations instead of the defaults. Whereas before, all the tests could live in the same test suite, now they had to be split into those that needed the fake implementation and those that did not. This is another slight limitation of this virtual library approach. You can only link one implementation at a time to an executable (or test). Thus, the dune rules for running the <html:code>dns_forward</html:code> test suite became:</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="dune-comment-line">; Uses the default  implementations provided by virtual libraries</html:span>
                        <html:span class="dune-source">
</html:span>
                        <html:span class="dune-meta-stanza"><![CDATA[(]]></html:span>
                        <html:span class="dune-meta-class-stanza">executable</html:span>
                        <html:span class="dune-meta-stanza">
</html:span>
                        <html:span class="dune-meta-stanza"> </html:span>
                        <html:span class="dune-meta-stanza-library-field"><![CDATA[(]]></html:span>
                        <html:span class="dune-keyword-other">name</html:span>
                        <html:span class="dune-meta-stanza-library-field"> </html:span>
                        <html:span class="dune-meta-atom">test</html:span>
                        <html:span class="dune-meta-stanza-library-field"><![CDATA[)]]></html:span>
                        <html:span class="dune-meta-stanza">
</html:span>
                        <html:span class="dune-meta-stanza"> </html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"><![CDATA[(]]></html:span>
                        <html:span class="dune-keyword-other">libraries</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"> </html:span>
                        <html:span class="dune-meta-atom">dns_forward</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"> </html:span>
                        <html:span class="dune-meta-atom">alcotest</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"><![CDATA[)]]></html:span>
                        <html:span class="dune-meta-stanza"><![CDATA[)]]></html:span>
                        <html:span class="dune-source">
</html:span>
                        <html:span class="dune-source">
</html:span>
                        <html:span class="dune-comment-line">; Override the defaults and select the private fake libraries</html:span>
                        <html:span class="dune-source">
</html:span>
                        <html:span class="dune-meta-stanza"><![CDATA[(]]></html:span>
                        <html:span class="dune-meta-class-stanza">executable</html:span>
                        <html:span class="dune-meta-stanza">
</html:span>
                        <html:span class="dune-meta-stanza">  </html:span>
                        <html:span class="dune-meta-stanza-library-field"><![CDATA[(]]></html:span>
                        <html:span class="dune-keyword-other">name</html:span>
                        <html:span class="dune-meta-stanza-library-field"> </html:span>
                        <html:span class="dune-meta-atom">test_fake</html:span>
                        <html:span class="dune-meta-stanza-library-field"><![CDATA[)]]></html:span>
                        <html:span class="dune-meta-stanza">
</html:span>
                        <html:span class="dune-meta-stanza">  </html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"><![CDATA[(]]></html:span>
                        <html:span class="dune-keyword-other">libraries</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"> </html:span>
                        <html:span class="dune-meta-atom">dns_forward</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"> </html:span>
                        <html:span class="dune-meta-atom">alcotest</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"> </html:span>
                        <html:span class="dune-meta-atom">fake_sleep</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"> </html:span>
                        <html:span class="dune-meta-atom">fake_time</html:span>
                        <html:span class="dune-meta-stanza-lib-or-exec-buildable"><![CDATA[)]]></html:span>
                        <html:span class="dune-meta-stanza"><![CDATA[)]]></html:span>
                        <html:span class="dune-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>With all of this machinery in place, I could now update <html:code>test_fake</html:code> to use the new modules that would provide the custom functionality for the clock and time implementations.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                        <html:span class="ocaml-comment-block"> The bad server should be marked offline and no-one will wait for it </html:span>
                        <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Fake_time_state</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">reset</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-unit"><![CDATA[()]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                        <html:span class="ocaml-comment-block"> avoid the timeouts winning the race with the actual result </html:span>
                        <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Fake_time_state</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">advance</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Duration</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">of_ms</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">500</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                      </html:code>
                    </html:pre>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors />
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>28</fr:day>
                    </fr:date>
                    <fr:title text="Conclusion">Conclusion</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>The switch to <fr:link href="/dune-virt-libs/" title="Dune Virtual Libraries" uri="https://patrick.sirref.org/dune-virt-libs/" display-uri="dune-virt-libs" type="local">dune virtual libraries</fr:link> seems to be a good one. A majority of applications only require a single clock or time implementation. However, it has become harder to inject custom implementations of various resources into your MirageOS-based applications.</html:p>
                    <html:p>The <fr:link href="https://github.com/moby/vpnkit/pull/646" type="external">pull request to upgrade VPNKit is open</fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" expanded="false" toc="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2023</fr:year>
                  <fr:month>8</fr:month>
                  <fr:day>9</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/ocaml-rtree/</fr:uri>
                <fr:display-uri>ocaml-rtree</fr:display-uri>
                <fr:route>/ocaml-rtree/</fr:route>
                <fr:title text="Reviving OCaml R-Tree">Reviving OCaml R-Tree</fr:title>
                <fr:meta name="description">Fast-forwarding a decade-old OCaml implementation of the R-Tree geospatial data-structure.
</fr:meta>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Antonin Guttman <fr:link href="http://www-db.deis.unibo.it/courses/SI-LS/papers/Gut84.pdf" type="external">first proposed R-Trees in 1984</fr:link>.</html:p>
                <html:blockquote>
                  <html:p>In order to handle spatial data efficiently, as required in computer aided design and geo-data applications, a database system needs an index mechanism that will help it retrieve data items quickly according to their spatial locations...</html:p>
                </html:blockquote>
                <html:p>There are lots of excellent resources for understanding more about R-Trees and all of the wonderful variations there of (e.g. <fr:link href="http://www.cs.ucr.edu/~ravi/CS236Papers/rstar.pdf" type="external">R*-trees</fr:link>). This <fr:link href="https://www.bartoszsypytkowski.com/r-tree/" type="external">blog post</fr:link> seems to be the most popular introduction.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/ocaml-rtree-001/</fr:uri>
                    <fr:display-uri>ocaml-rtree-001</fr:display-uri>
                    <fr:route>/ocaml-rtree-001/</fr:route>
                    <fr:title text="An OCaml Rtree Implementation">An OCaml Rtree Implementation</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>In the <fr:link href="https://www.cst.cam.ac.uk/research/eeg" type="external">Energy and Environment Group</fr:link> we are working on various geospatial tools, one of which is written in OCaml and needed a geospatial index to speedup spatial queries over a dataset. Searching Github revealed <fr:link href="https://github.com/mariusae/ocaml-rtree" type="external">an implementation in pure OCaml</fr:link>. After reaching out to the author, they were more than happy for their work to be maintained in the <fr:link href="https://github.com/geocaml" type="external">Geocaml organisation</fr:link>, updated to the latest OCaml tools and <fr:link href="https://github.com/ocaml/opam-repository/pull/24227" type="external">hopefully released on opam</fr:link>.</html:p>
                    <html:p>The <fr:link href="https://github.com/geocaml/ocaml-rtree/commit/073d79ad34de15f0671f2faafb24b1edc5c2d8c7" type="external">dunification</fr:link> went smoothly whilst fast-forwarding 15 OCaml compiler versions with no changes or problems (just dune unused variable warnings).</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/ocaml-rtree-002/</fr:uri>
                    <fr:display-uri>ocaml-rtree-002</fr:display-uri>
                    <fr:route>/ocaml-rtree-002/</fr:route>
                    <fr:title text="OCaml Rtree Examples">OCaml Rtree Examples</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>An R-Tree in OCaml is created from an envelope (the kind of bounding box) and a value (for storing in the tree). The value depends on the envelope as you have to provide a function to calculate an envelope from a value. Here is one way we might define a line using the provided two-dimensional <html:code>Rectangle</html:code> envelope.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">struct</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p0</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">open</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Repr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">in</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source">record</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">line</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p0</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p0</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword-operator">|+</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">field</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">p0</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">pair</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">p0</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword-operator">|+</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">field</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">p1</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">pair</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-keyword-other">fun</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">p1</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword-operator">|&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">sealr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">envelope</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rtree</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rectangle</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">t</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">envelope</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p0</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">x1</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y1</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">p1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-source">x2</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y2</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">x0</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Float</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">min</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x2</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">in</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">x1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Float</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">max</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x2</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">in</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">y0</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Float</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">min</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y2</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">in</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">y1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Float</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">max</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">y2</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">in</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rtree</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rectangle</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">v</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">x0</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">y0</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">x1</html:span>
                        <html:span class="ocaml-source"> ~</html:span>
                        <html:span class="ocaml-source">y1</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword-other">end</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>In addition to the <html:code>envelope</html:code> function, we also need to provide a runtime representation using <html:code>Repr</html:code>. In the example, we've constructed it by hand but I recommend using <fr:link href="https://ocaml.org/p/ppx_repr/latest" type="external">ppx_repr</fr:link> to derive it for you. From here we can create our index.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rtree</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Make</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rtree</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Rectangle</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:uri>https://patrick.sirref.org/ocaml-rtree-003/</fr:uri>
                        <fr:display-uri>ocaml-rtree-003</fr:display-uri>
                        <fr:route>/ocaml-rtree-003/</fr:route>
                        <fr:title text="Inserting Values">Inserting Values</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>There are two ways to insert values into the index -- either by inserting them one-by-one or by bulk loading them. The latter is the recommended approach where possible as the resulting layout of the R-Tree is much better.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-mdx-hash">#</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">r</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">i</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">empty</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">4</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other">in</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">insert</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">i</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-keyword-other">val</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">r</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">t</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">&lt;</html:span>
                            <html:span class="ocaml-source">abstr</html:span>
                            <html:span class="ocaml-keyword-operator">&gt;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>As you might expect, bulk loading takes a list of values instead.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-mdx-hash">#</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">r</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword">let</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-entity-name-function-binding">lines</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">        </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">        </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">0.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">0.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">        </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">        </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">3.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">3.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">        </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">3.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">3.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">4.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">4.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">        </html:span>
                            <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-keyword-other">in</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source">    </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">load</html:span>
                            <html:span class="ocaml-source"> ~</html:span>
                            <html:span class="ocaml-source">max_node_load</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-constant-numeric-decimal-integer">4</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">lines</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-keyword-other">val</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">r</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">t</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">&lt;</html:span>
                            <html:span class="ocaml-source">abstr</html:span>
                            <html:span class="ocaml-keyword-operator">&gt;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:uri>https://patrick.sirref.org/ocaml-rtree-004/</fr:uri>
                        <fr:display-uri>ocaml-rtree-004</fr:display-uri>
                        <fr:route>/ocaml-rtree-004/</fr:route>
                        <fr:title text="Spatial Queries">Spatial Queries</fr:title>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <html:p>The lines we loaded into the last index are really just four segments of the line <html:code>y = x</html:code>. Let's spatially query for the first two segments.</html:p>
                        <html:pre class="hilite">
                          <html:code>
                            <html:span class="ocaml-mdx-hash">#</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">find</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">r</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Rtree</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Rectangle</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">v</html:span>
                            <html:span class="ocaml-source"> ~</html:span>
                            <html:span class="ocaml-source">x0</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">0.</html:span>
                            <html:span class="ocaml-source"> ~</html:span>
                            <html:span class="ocaml-source">y0</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">0.</html:span>
                            <html:span class="ocaml-source"> ~</html:span>
                            <html:span class="ocaml-source">x1</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"> ~</html:span>
                            <html:span class="ocaml-source">y1</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-keyword-operator">-</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">t</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">list</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">0.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">0.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">1.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source">
</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                            <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                            <html:span class="ocaml-source">p0</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">2.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source">p1</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-keyword-operator">=</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">3.</html:span>
                            <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                            <html:span class="ocaml-source"> </html:span>
                            <html:span class="ocaml-constant-numeric-decimal-float">3.</html:span>
                            <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                            <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                            <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                            <html:span class="ocaml-source">
</html:span>
                          </html:code>
                        </html:pre>
                        <html:p>You can see the query actually returned the first three, that's because all bound checks are inclusive.</html:p>
                      </fr:mainmatter>
                    </fr:tree>
                  </fr:mainmatter>
                </fr:tree>
                <html:p>The <fr:link href="https://github.com/geocaml/ocaml-rtree/blob/d0a789b8eb6c594ed8c0f9c9a6c4b5cd7c734a03/test/image.ml#L95-L106" type="external">source repository includes a fairly simple example of rendering an R-Tree</fr:link> using <fr:link href="https://github.com/dbuenzli/vg" type="external">Vg</fr:link>. This can be done outside of the repository using the <html:code>tree</html:code> representation.</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-mdx-hash">#</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">#</html:span>
                    <html:span class="ocaml-keyword-other">show</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                    <html:span class="ocaml-source">.</html:span>
                    <html:span class="ocaml-source">tree</html:span>
                    <html:span class="ocaml-source">;;</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-other">val</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">tree</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">tree</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-other">type</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">nonrec</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">tree</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">tree</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">    </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Node</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">of</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">envelope</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">*</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">R</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">tree</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">list</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword-other">|</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Leaf</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">of</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">envelope</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">*</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Line</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">list</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword-other">|</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Empty</html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <html:p>Here is an example rendering from the repository showing some random lines and the envelopes of the R-tree.</html:p>
                <html:p style="text-align:center">
    <html:img src="./rtree.svg" />
</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Backlinks">Backlinks</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2026</fr:year>
              <fr:month>2</fr:month>
              <fr:day>9</fr:day>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/fellowship-roundup/</fr:uri>
            <fr:display-uri>fellowship-roundup</fr:display-uri>
            <fr:route>/fellowship-roundup/</fr:route>
            <fr:title text="Fellowship Roundup">Fellowship Roundup</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2026</fr:year>
                  <fr:month>2</fr:month>
                  <fr:day>9</fr:day>
                </fr:date>
                <fr:title text="Overview">Overview</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>February is the final month of my current six-month fellowship work with <fr:link href="https://tarides.com/" type="external">Tarides</fr:link>. A lot of the work can be summarised by reading the <fr:link href="/ocaml-blog/" title="Patrick's OCaml Blog" uri="https://patrick.sirref.org/ocaml-blog/" display-uri="ocaml-blog" type="local">roundups</fr:link> (see <fr:link href="/ocaml-roundup-october-2025/" title="OCaml Roundup: October 2025" uri="https://patrick.sirref.org/ocaml-roundup-october-2025/" display-uri="ocaml-roundup-october-2025" type="local">October</fr:link>, <fr:link href="/ocaml-roundup-november-2025/" title="OCaml Roundup: November 2025" uri="https://patrick.sirref.org/ocaml-roundup-november-2025/" display-uri="ocaml-roundup-november-2025" type="local">November</fr:link>, <fr:link href="/ocaml-roundup-december-2025/" title="OCaml Roundup: December 2025" uri="https://patrick.sirref.org/ocaml-roundup-december-2025/" display-uri="ocaml-roundup-december-2025" type="local">December</fr:link> and <fr:link href="/ocaml-roundup-january-2026/" title="OCaml Roundup: January 2026" uri="https://patrick.sirref.org/ocaml-roundup-january-2026/" display-uri="ocaml-roundup-january-2026" type="local">January</fr:link>). I have been writing throughout the fellowship. However, they do not quite capture all the work I have been doing.</html:p>
                <html:p>Below, I pick individual projects and expand on them more holistically rather than pointing at individual PRs or issues.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Ppxlib">Ppxlib</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Most of my time over the past six months has been devoted to <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> maintenance. A large proportion of this time has been solo development work. <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">Ppxlib</fr:link> is a cornerstone library of the OCaml ecosystem (whether people like it or not).</html:p>
                    <html:pre><![CDATA[$ opam list --depends-on=ppxlib --recursive | wc -l
2030]]></html:pre>
                    <html:p>Moreover, it is completely invaluable to Jane Street too. Like other AST-based tools (e.g. ocamlformat, merlin), <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> must follow a regular release schedule to support newer compilers. During the years of multicore OCaml development, <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> maintenance was a little easier as the Parsetree rarely changed. However, since then, the same cannot be said. Since OCaml 5.2, here are just some of the Parsetree changes:</html:p>
                    <html:ul>
                      <html:li>
                        <html:p>Functions are represented according to their arity.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>Local module opens on types.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>Effect syntax.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>Modular explicits.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>External types.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>Locations for all parts of long identifiers.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>Labeled tuples.</html:p>
                      </html:li>
                    </html:ul>
                    <html:p>In a perfect world, each of these require a codec for serialising the feature into ASTs that do not support the feature, plenty of tests and new <html:code>Ast_builder</html:code>/<html:code>Ast_pattern</html:code> functions for using the feature. <fr:link href="/nathanreb/" title="Nathan Rebours" uri="https://patrick.sirref.org/nathanreb/" display-uri="nathanreb" type="local">Nathan</fr:link> and I have been managing pretty well I would say, though we are not getting any technical debt work done.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Outreachy">Outreachy</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>As the OCaml coordinator for <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link> I have been running the latest December 2025 round. We are lucky to have <html:em>four</html:em> projects on the go!</html:p>
                    <html:ul>
                      <html:li>
                        <html:p>Thibaut Mattio is mentoring two projects: <fr:link href="https://www.outreachy.org/outreachy-december-2025-internship-cohort/communities/ocaml/#raven-create-a-monitoring-dashboard-for-deep-learn" type="external">an ML dashboard for Raven</fr:link> and <fr:link href="https://www.outreachy.org/outreachy-december-2025-internship-cohort/communities/ocaml/#create-an-oxcaml-backend-for-raven" type="external">an OxCaml backend for Raven</fr:link>.</html:p>
                      </html:li>
                      <html:li>
                        <html:p><fr:link href="https://github.com/xvw" type="external">Xvw</fr:link> is mentoring a <fr:link href="https://github.com/yocaml/" type="external">Yocaml</fr:link> <fr:link href="https://www.outreachy.org/outreachy-december-2025-internship-cohort/communities/ocaml/#improve-yocaml-error-reporting-and-data-model" type="external">project</fr:link>.</html:p>
                      </html:li>
                      <html:li>
                        <html:p>I am <fr:link href="/outreachy-ocaml-tiff/" title="Write support in OCaml TIFF library" uri="https://patrick.sirref.org/outreachy-ocaml-tiff/" display-uri="outreachy-ocaml-tiff" type="local">mentoring</fr:link> a <fr:link href="/geocaml/" title="Geocaml" uri="https://patrick.sirref.org/geocaml/" display-uri="geocaml" type="local">Geocaml</fr:link> project.</html:p>
                      </html:li>
                    </html:ul>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Eio">Eio</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>During my work on tools like <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> I have made a few improvements to <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> including:</html:p>
                    <html:ul>
                      <html:li>
                        <html:p><fr:link href="https://github.com/ocaml-multicore/eio/pull/821" type="external">A draft PR for incremental reading of directories</fr:link>.</html:p>
                      </html:li>
                      <html:li>
                        <html:p><fr:link href="https://github.com/ocaml-multicore/eio/pull/803" type="external">New fork actions for processes: setgid, setuid and process groups</fr:link>.</html:p>
                      </html:li>
                      <html:li>
                        <html:p><fr:link href="https://github.com/ocaml-multicore/eio/pull/823" type="external">Utility functions for overriding standard environments</fr:link>.</html:p>
                      </html:li>
                      <html:li>
                        <html:p><fr:link href="https://github.com/ocaml-multicore/eio/pull/822" type="external">Fixing documentation</fr:link>.</html:p>
                      </html:li>
                    </html:ul>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="OxCaml">OxCaml</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>I have enjoyed my work on OxCaml went it has happend. I think a few tools have been useful including the <fr:link href="/try-oxcaml/" title="Try OxCaml" uri="https://patrick.sirref.org/try-oxcaml/" display-uri="try-oxcaml" type="local">try-oxcaml</fr:link> work. <fr:link href="/dra27/" title="David Allsopp" uri="https://patrick.sirref.org/dra27/" display-uri="dra27" type="local">David</fr:link> and I also had fun at <fr:link href="/icfp-2025/" title="ICFP 2025" uri="https://patrick.sirref.org/icfp-2025/" display-uri="icfp-2025" type="local">ICFP</fr:link> discussing some quick experiments related to <fr:link href="/icfp-oxcaml-uring/" title="OCaml Roundup: October 2025 › OxCaml Experiments " uri="https://patrick.sirref.org/icfp-oxcaml-uring/" display-uri="icfp-oxcaml-uring" type="local">io_uring and OxCaml</fr:link>.</html:p>
                    <html:p>One road-blocker here is the comparative amount of time spent trying to keep the OxCaml ecosystem working. Given my limited time working on fellowship projects, the rate of change of OxCaml (including the opam ecosystem) meant most of the time was spent making it just work, not exploring or experimenting with the features themselves. I think this has got better in recent months and perhaps jumping back in I would be surprised at the progress that has been made there.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Forester">Forester</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p><fr:link href="https://tarides.org/" type="external">Tarides</fr:link> are funding some work on <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link>. This site uses <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">forester</fr:link> by way of <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">graft</fr:link> and I have spent some time working on these tools during the fellowship.</html:p>
                    <html:p>This includes a <html:code>bytesrw</html:code>-based <fr:link href="/bib/" title="Bib" uri="https://patrick.sirref.org/bib/" display-uri="bib" type="local">bibtex</fr:link> library in OCaml that could be released soon.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Papers">Papers</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>I had the great fortune of attending <fr:link href="https://patrick.sirref.org/ifcp-2025/" type="external">ICFP</fr:link> where I presented two talks and was co-author on a few others too.</html:p>
                    <html:hr />
                    <fr:tree show-metadata="false" expanded="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/David J. Scott" type="external">David J. Scott</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Ryan T. Gibb" type="external">Ryan T. Gibb</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Thomas Gazagnaire/" type="external">Thomas Gazagnaire</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/madhavapeddy2025docker/</fr:uri>
                        <fr:display-uri>madhavapeddy2025docker</fr:display-uri>
                        <fr:route>/madhavapeddy2025docker/</fr:route>
                        <fr:title text="Functional Networking for Millions of Docker Desktops (Experience Report)">Functional Networking for Millions of Docker Desktops (Experience Report)</fr:title>
                        <fr:taxon>Reference</fr:taxon>
                        <fr:meta name="external">https://dl.acm.org/doi/10.1145/3747525</fr:meta>
                        <fr:meta name="journal">Proc. ACM Program. Lang.</fr:meta>
                        <fr:meta name="doi">10.1145/3747525</fr:meta>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/David J. Scott" type="external">David J. Scott</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Ryan T. Gibb" type="external">Ryan T. Gibb</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Thomas Gazagnaire/" type="external">Thomas Gazagnaire</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                            </fr:date>
                            <fr:title text="Abstract">Abstract</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>
	Docker is a developer tool used by millions of developers to build, share
	and run software stacks. The Docker Desktop clients for Mac and Windows
	have long used a novel combination of virtualisation and OCaml unikernels
	to seamlessly run Linux containers on these non-Linux hosts.

	We reflect on a decade of shipping this functional OCaml code into
	production across hundreds of millions of developer desktops, and discuss
	the lessons learnt from our experiences in integrating OCaml deeply into
	the container architecture that now drives much of the global cloud. We
	conclude by observing just how good a fit for systems programming that the
	unikernel approach has been, particularly when combined with the OCaml
	module and type system.
</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" expanded="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/ferris2025scientific_programming/</fr:uri>
                        <fr:display-uri>ferris2025scientific_programming</fr:display-uri>
                        <fr:route>/ferris2025scientific_programming/</fr:route>
                        <fr:title text="What we talk about when we talk about scientific programming">What we talk about when we talk about scientific programming</fr:title>
                        <fr:taxon>Reference</fr:taxon>
                        <fr:meta name="external">https://watch.eeg.cl.cam.ac.uk/w/aYXqXLtgQawYMjVXjSQtjx</fr:meta>
                        <fr:meta name="doi" />
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                            </fr:date>
                            <fr:title text="Abstract">Abstract</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>
	Programming for the planet undoubtedly involves programming
	scientifically, but what kind of programming are we talking about
	and what makes it scientific? In what ways does it differ from
	other forms of programming, if at all? Is scientific programming,
	data science or machine learning fundamentally different to
	constructing a compiler or building a high-throughput web server?
	By considering how the scientific method (with its falsifiable
	hypotheses and repeatable and reproducible experiments) relates to
	scientific programming, I hope to explore how computer science and
	traditional programming techniques are coming up short in meeting
	the requirements of scientific programmers.
</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" expanded="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/ferris2025hazel_of_ocaml/</fr:uri>
                        <fr:display-uri>ferris2025hazel_of_ocaml</fr:display-uri>
                        <fr:route>/ferris2025hazel_of_ocaml/</fr:route>
                        <fr:title text="Generating a corpus of Hazel programs from ill-typed OCaml programs">Generating a corpus of Hazel programs from ill-typed OCaml programs</fr:title>
                        <fr:taxon>Reference</fr:taxon>
                        <fr:meta name="external">https://patrick.sirref.org/var/tyde2025.pdf</fr:meta>
                        <fr:meta name="doi" />
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                            </fr:date>
                            <fr:title text="Abstract">Abstract</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>
		When developing a new programming language, having a large corpus of
		both correct and incorrect programs allows language designers to test
		and explore the capabilities of their new language. However,
		bootstrapping such a corpus of incorrect programs is time-consuming and
		arduous. We therefore explore how to reuse code from more mature
		languages to generate a corpus of ill-typed code for newer ones. We
		have developed a compiler to Hazel, an emerging language with typed
		holes, from the more mature OCaml ecosystem. We find it practical to
		generate a comprehensive corpus of ill-typed programs for Hazel
		development, and discuss future larger scale efforts towards bridging
		ecosystems.
</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <html:p>See also <fr:link href="https://patricoferris.github.io/hazel_of_ocaml/" type="external">the online hazel of ocaml compiler</fr:link></html:p>
                    <fr:tree show-metadata="false" expanded="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Max Carroll/" type="external">Max Carroll</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/carroll2025decomposable_type_highlighting/</fr:uri>
                        <fr:display-uri>carroll2025decomposable_type_highlighting</fr:display-uri>
                        <fr:route>/carroll2025decomposable_type_highlighting/</fr:route>
                        <fr:title text="Decomposable Type Highlighting for Bidirectional Type and Cast Systems">Decomposable Type Highlighting for Bidirectional Type and Cast Systems</fr:title>
                        <fr:taxon>Reference</fr:taxon>
                        <fr:meta name="external">https://maxcarroll0.github.io/papers/workshops/HATRA-decomposable-type-highlighting/</fr:meta>
                        <fr:meta name="doi" />
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Max Carroll/" type="external">Max Carroll</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                            </fr:date>
                            <fr:title text="Abstract">Abstract</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>
		 We explore how to provide programmers with an interactive
		 interface for explaining the process by which static types and
		 dynamic casts are derived, with the goal of improving the
		 debugging of static and dynamic type errors. To this end, we
		 define mathematical foundations for a decomposable highlighting
		 system within a bidirectional system, and show how these can be
		 propagated through dynamic types in a cast system. Our prototype
		 implementation in the gradually typed Hazel language includes a
		 web-based user interface, through which we highlight the
		 importance of type level debugging.
</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <fr:tree show-metadata="false" expanded="false" numbered="false">
                      <fr:frontmatter>
                        <fr:authors>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Michael Winston Dales/" type="external">Michael Winston Dales</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Alison Eyres/" type="external">Alison Eyres</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Francesca A. Ridley" type="external">Francesca A. Ridley</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Simon Tarr/" type="external">Simon Tarr</fr:link>
                          </fr:author>
                          <fr:author>
                            <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                          </fr:author>
                        </fr:authors>
                        <fr:date>
                          <fr:year>2025</fr:year>
                        </fr:date>
                        <fr:uri>https://patrick.sirref.org/dales2025yirgacheffe/</fr:uri>
                        <fr:display-uri>dales2025yirgacheffe</fr:display-uri>
                        <fr:route>/dales2025yirgacheffe/</fr:route>
                        <fr:title text="Yirgacheffe: A Declarative Approach to Geospatial Data">Yirgacheffe: A Declarative Approach to Geospatial Data</fr:title>
                        <fr:taxon>Reference</fr:taxon>
                        <fr:meta name="external">https://dl.acm.org/doi/10.1145/3759536.3763806</fr:meta>
                        <fr:meta name="doi">10.1145/3759536.3763806</fr:meta>
                      </fr:frontmatter>
                      <fr:mainmatter>
                        <fr:tree show-metadata="false">
                          <fr:frontmatter>
                            <fr:authors>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Michael Winston Dales/" type="external">Michael Winston Dales</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Alison Eyres/" type="external">Alison Eyres</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Francesca A. Ridley" type="external">Francesca A. Ridley</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Simon Tarr/" type="external">Simon Tarr</fr:link>
                              </fr:author>
                              <fr:author>
                                <fr:link href="https://patrick.sirref.org/Anil Madhavapeddy/" type="external">Anil Madhavapeddy</fr:link>
                              </fr:author>
                            </fr:authors>
                            <fr:date>
                              <fr:year>2025</fr:year>
                            </fr:date>
                            <fr:title text="Abstract">Abstract</fr:title>
                          </fr:frontmatter>
                          <fr:mainmatter>
                            <html:p>
		We present Yirgacheffe, a declarative geospatial library that
		allows spatial algorithms to be implemented concisely, supports
		parallel execution, and avoids common errors by automatically
		handling data (large geospatial rasters) and resources (cores,
		memory, GPUs). Our primary user domain comprises ecologists,
		where a typical problem involves cleaning messy occurrence data,
		overlaying it over tiled rasters, combining layers, and deriving
		actionable insights from the results. We describe the successes
		of this approach towards driving key pipelines related to global
		biodiversity and describe the capability gaps that remain, hoping
		to motivate more research into geospatial domain-specific
		languages.
	</html:p>
                          </fr:mainmatter>
                        </fr:tree>
                      </fr:mainmatter>
                    </fr:tree>
                    <html:hr />
                    <html:p>I had some great conversations with <fr:link href="/kc/" title="KC Sivaramakrishnan" uri="https://patrick.sirref.org/kc/" display-uri="kc" type="local">KC</fr:link> too with respect to my current research.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2026</fr:year>
                  <fr:month>2</fr:month>
                  <fr:day>9</fr:day>
                </fr:date>
                <fr:title text="Future Work">Future Work</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>As I enter my final year of the PhD, my goal would be to try and align more of my fellowship work with my own research wherever it makes sense. This research focuses on the following hypothesis:</html:p>
                <html:blockquote>
                  <html:p>Embedding deep provenance tracking, reversible execution and mergeable histories directly into an interactive programming environment (a POSIX-like shell) greatly decreases the gap between exploratory scientific work and reproducible, publishable results; all whilst leaving existing workflows intact and being programming language agnostic.</html:p>
                </html:blockquote>
                <html:p>I want to focus on building these tools using <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>, <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link>, <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> etc. There are other projects I wish to continue regardless, like <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link>, though just as a coordinator (not a mentor).</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Overlapping PhD Work">Overlapping PhD Work</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>There are multiple projects that overlap with my work. For example, <fr:link href="/irmin/" title="Irmin" uri="https://patrick.sirref.org/irmin/" display-uri="irmin" type="local">Irmin</fr:link>, which I wrote a <fr:link href="/irmin-retro/" title="Irmin Retrospective" uri="https://patrick.sirref.org/irmin-retro/" display-uri="irmin-retro" type="local">retrospective</fr:link> for. This is at the core of <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> and suggests an extremely valid use case for a brancheable, mergeable database.</html:p>
                    <html:p>In addition to this, continuing to work on <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> makes sense to me too. <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> currently has no maintainer and no active development, but the <fr:link href="https://github.com/ocaml-multicore/eio/issues" type="external">issues are piling up</fr:link>. In particular, I am making heavy use of <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> in <fr:link href="/merry/" title="Merry" uri="https://patrick.sirref.org/merry/" display-uri="merry" type="local">Merry</fr:link>, a POSIX(ish) shell written in OCaml. Aside from research angles on brancheable and mergeable shells, I am also quite interested in how this might look in terms of OxCaml. I met with <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil</fr:link> and <fr:link href="/talex5/" title="Thomas Leonard" uri="https://patrick.sirref.org/talex5/" display-uri="talex5" type="local">Thomas</fr:link> recently to discuss the future of <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> and there was some agreement that we are all heavy users of it and hope to keep up its maintenance and set of features.</html:p>
                    <html:p>One large piece of work that is sorely needed here is moving <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link> to <html:code>bytes</html:code> and not bigarray-backed <html:code>Cstruct</html:code>s. Any libraries using <html:code>bytesrw</html:code> (e.g. <html:code>jsont</html:code>) incur an extra copy of data into and out of the bytes. <fr:link href="/anilmadhavapeddy/" title="Anil Madhavapeddy" uri="https://patrick.sirref.org/anilmadhavapeddy/" display-uri="anilmadhavapeddy" type="local">Anil</fr:link> has been <fr:link href="https://anil.recoil.org/notes/oxcaml-httpz" type="external">working on some of the pieces</fr:link> recently to make this better!</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Maintaining and Releasing my own libraries">Maintaining and Releasing my own libraries</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>I have published quite a few OCaml libraries in my time, below is just a few libraries (filtered to not include OCurrent projects).</html:p>
                    <html:pre><![CDATA[$ opam list --all --no-switch --columns=name,authors: | grep -E "sirref|Ferris" | cut -d " " -f1
carbon
geojson
geojsone
graft
hilite
ISO3166
jekyll-format
ppx_deriving_ezjsonm
ppx_deriving_yaml
rtree
search
topojson
topojsone
cid
multibase
multicodec
multihash
multihash-digestif]]></html:pre>
                    <html:p>Some of these are used in the community including <html:code>hilite</html:code>, <html:code>ppx_deriving_yaml</html:code> and the multi-codecs. I would like to do some general maintenance of some of these tools and release a few iterations of <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">graft</fr:link> which now makes use of <fr:link href="/bib/" title="Bib" uri="https://patrick.sirref.org/bib/" display-uri="bib" type="local">bib</fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Ppxlib Maintenance">Ppxlib Maintenance</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>By far, maintenance of <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> takes up a majority of my time. I think, given the other work I need to focus on, it would be great to try to minimise the amount of time working on <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link>. In particular, perhaps only maintaining <fr:link href="/ppxlib/" title="Ppxlib" uri="https://patrick.sirref.org/ppxlib/" display-uri="ppxlib" type="local">ppxlib</fr:link> as far as OCaml release-readiness is a possibility and important bug fixes (like <fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/613" type="external">the OOM bug reported by Jane Street</fr:link>).</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2026</fr:year>
                      <fr:month>2</fr:month>
                      <fr:day>9</fr:day>
                    </fr:date>
                    <fr:title text="Forester, Graft and Writing">Forester, Graft and Writing</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>With all of this work, I am eager to communicate what I am up to and my thoughts on open source, OCaml, OxCaml etc. I am glad to be using <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link> to do this, particularly as it is written in OCaml (and could make great use of my own work on <fr:link href="/eio/" title="Eio" uri="https://patrick.sirref.org/eio/" display-uri="eio" type="local">Eio</fr:link>).</html:p>
                    <html:p>I hope to continue working on <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">Graft</fr:link> and related tools like <fr:link href="/bib/" title="Bib" uri="https://patrick.sirref.org/bib/" display-uri="bib" type="local">bib</fr:link>. But I would also like to start writing some long-form content similar to the <fr:link href="/irmin-retro/" title="Irmin Retrospective" uri="https://patrick.sirref.org/irmin-retro/" display-uri="irmin-retro" type="local">Irmin retrospective</fr:link>.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>11</fr:month>
              <fr:day>10</fr:day>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/weekly-2025-w45/</fr:uri>
            <fr:display-uri>weekly-2025-w45</fr:display-uri>
            <fr:route>/weekly-2025-w45/</fr:route>
            <fr:title text="Taking stock &amp; Graft updates">Taking stock &amp; Graft updates</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>I ended up working on a real mix of things last week. I managed to get two large posts uploaded to this site: an <fr:link href="/icfp-2025/" title="ICFP 2025" uri="https://patrick.sirref.org/icfp-2025/" display-uri="icfp-2025" type="local">ICFP recap</fr:link> and a deeper-dive into the random bits of <fr:link href="/ocaml-roundup-october-2025/" title="OCaml Roundup: October 2025" uri="https://patrick.sirref.org/ocaml-roundup-october-2025/" display-uri="ocaml-roundup-october-2025" type="local">OCaml hacking</fr:link>. This was pretty useful in terms of taking stock of where I was at, I always find post-conference, I'm a little lost. The conversations and ideas from ICFP are simultaneously exciting but also pretty inactionable.</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>10</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/graft-updates/</fr:uri>
                <fr:display-uri>graft-updates</fr:display-uri>
                <fr:route>/graft-updates/</fr:route>
                <fr:title text="Graft Updates ">Graft Updates </fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>It would seem that there is a potential <html:em>second</html:em> user of <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">Graft</fr:link>! A great source of motivation for some tidying and feature implementing. At the end of last week I fixed some little bugs in <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">Graft</fr:link> and (more importantly) allowed <fr:link href="https://graft.sirref.org/named-subtrees" type="external">users to name their subtrees</fr:link>. Upstream <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">Graft</fr:link> also now pins and uses my <fr:link href="/bib/" title="Bib" uri="https://patrick.sirref.org/bib/" display-uri="bib" type="local">Bibtex implementation</fr:link>.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>10</fr:day>
                </fr:date>
                <fr:title text="OCaml Geotessera">OCaml Geotessera</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>As I discussed in my <fr:link href="/ocaml-roundup-october-2025/" title="OCaml Roundup: October 2025" uri="https://patrick.sirref.org/ocaml-roundup-october-2025/" display-uri="ocaml-roundup-october-2025" type="local">OCaml roundup</fr:link>, I spent a bit of time polishing the <fr:link href="https://tangled.org/@patrick.sirref.org/ocaml-geotessera" type="external">OCaml geotessera code</fr:link>. In particular this meant starting to handle low-level geospatial transformations allowing users to project latitudes and longitudes into the rows and columns of their raster data. I feel like I'm stumbling onto a path <fr:link href="/mdales/" title="Michael W. Dales" uri="https://patrick.sirref.org/mdales/" display-uri="mdales" type="local">Michael</fr:link> has carved out with <fr:link href="https://github.com/quantifyearth/yirgacheffe/" type="external">Yirgacheffe</fr:link>. I'm following <fr:link href="https://digitalflapjack.com/weeknotes/2025-11-10/" type="external">along with his work excitedly</fr:link> and we had a good catch-up last week discussing how libraries should handle things like automatic, numeric precision conversion.</html:p>
                <html:p>As a fully paid-up member of the static types fan club, I'm often evangelising the benefits of types. However, I hit a little quirk of the <fr:link href="https://ocaml.org/p/nx" type="external">Nx</fr:link> library in OCaml (a numpy equivalent). Take a look at this sum function:</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-keyword">let</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-entity-name-function-binding">sum</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">nx</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">sum</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">nx</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">|&gt;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">item</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-other">val</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">sum</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-storage-type">'a</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-storage-type">'b</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-storage-type">'a</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword">let</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-entity-name-function-binding">arr</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">create</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">int8</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[[|]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-numeric-decimal-integer">2</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[|]]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[[|]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-numeric-decimal-integer">64</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-numeric-decimal-integer">64</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[|]]]></html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-other">val</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">arr</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-support-type">int</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-comma punctuation-separator">,</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Bigarray</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">int8_signed_elt</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Nx</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">sum</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">arr</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-keyword-operator">-</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-support-type">int</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">-</html:span>
                    <html:span class="ocaml-constant-numeric-decimal-integer">128</html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <html:p>Even though <html:code>sum</html:code> takes an <html:code>('a, 'b) Nx.t</html:code> array that stores elements with representation <html:code>'b</html:code> and allows you to read/write to the elements with OCaml values of type <html:code>'a</html:code>, the <html:code>sum</html:code> function performs the calculation in the world of the <html:code>'b</html:code> representation type (here signed 8-bit integers). So we get an overflow! Perhaps not too surprising but easy to overlook! The moral of the story is that we still need to be careful in the OCaml world too.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>10</fr:day>
                </fr:date>
                <fr:title text="Shelter">Shelter</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>I did a little cleaning up of the <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> code too. I noticed a few bugs from the demos I did at <fr:link href="/icfp-2025/" title="ICFP 2025" uri="https://patrick.sirref.org/icfp-2025/" display-uri="icfp-2025" type="local">ICFP</fr:link>. Most were pretty straight-forward to fix, and the test-suite is now checking <fr:link href="https://github.com/fn06/shelter/blob/main/test/fixtures/for.shl" type="external">parallel for-loops</fr:link> and <fr:link href="https://github.com/fn06/shelter/blob/main/test/fixtures/if.shl" type="external">conditional execution</fr:link> are working.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>10</fr:day>
                </fr:date>
                <fr:title text="This week">This week</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>I hope to get a few things done this week:</html:p>
                <html:ul>
                  <html:li>
                    <html:p>Run some part of the <fr:link href="https://github.com/quantifyearth/LIFE" type="external">LIFE</fr:link> pipeline through <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link>.</html:p>
                  </html:li>
                  <html:li>
                    <html:p>Deploy the <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link> daemon allowing other people to connect and take it for a spin.</html:p>
                  </html:li>
                  <html:li>
                    <html:p>Spend some time writing and reading, pulling ideas together rather than always writing code!</html:p>
                  </html:li>
                  <html:li>
                    <html:p>I have a slightly harebrained scheme that combines <fr:link href="/shelter/" title="Shelter" uri="https://patrick.sirref.org/shelter/" display-uri="shelter" type="local">Shelter</fr:link>, atproto, <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link>, capn(proto/web) and webcomponents... I want to see if I can pull that together.</html:p>
                  </html:li>
                </html:ul>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>11</fr:month>
              <fr:day>5</fr:day>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/ocaml-roundup-october-2025/</fr:uri>
            <fr:display-uri>ocaml-roundup-october-2025</fr:display-uri>
            <fr:route>/ocaml-roundup-october-2025/</fr:route>
            <fr:title text="OCaml Roundup: October 2025">OCaml Roundup: October 2025</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Welcome to a monthly roundup of OCaml-related open-source work I have been involved with. If you haven't already, a quick look at <fr:link href="/icfp-2025/" title="ICFP 2025" uri="https://patrick.sirref.org/icfp-2025/" display-uri="icfp-2025" type="local">my ICFP roundup</fr:link> might be a good preface to what follows.</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>5</fr:day>
                </fr:date>
                <fr:title text="Outreachy December 2025">Outreachy December 2025</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>The contribution period for this year's <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link> round took place for most of the month of October. This year I am excited to be going back to a <fr:link href="/geocaml/" title="Geocaml" uri="https://patrick.sirref.org/geocaml/" display-uri="geocaml" type="local">Geocaml</fr:link> project, working primarily to add writing capabilities to <fr:link href="https://github.com/geocaml/ocaml-tiff" type="external">ocaml-tiff</fr:link>.</html:p>
                <html:p>As per usual, I have been extremely pleased with the level of interest in the various <fr:link href="https://www.outreachy.org/apply/project-selection/#ocaml" type="external">OCaml projects being offered</fr:link>. Whilst we are still deliberating on our choices for interns this year, I won't say much more on the contributions, but if you want to get involved please do reach out! OCaml is a great language for geospatial work, striking a balance between reasonable performance for numerical code and also a rich type system for expressing complicated geospatial data-structures.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>5</fr:day>
                </fr:date>
                <fr:title text="Ppxlib and the Future of Compiler Support">Ppxlib and the Future of Compiler Support</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/nathanreb/" title="Nathan Rebours" uri="https://patrick.sirref.org/nathanreb/" display-uri="nathanreb" type="local">Nathan</fr:link> has put a tremendous amount of effort into laying a roadmap this month for <fr:link href="https://discuss.ocaml.org/t/ann-ppxlib-support-for-future-compilers/17430" type="external">how ppxlib, going forward, will support future compilers</fr:link>. This is in response to the calamity that was <fr:link href="/ppxlib-5-2/" title="Bumping Ppxlib's AST to 5.2" uri="https://patrick.sirref.org/ppxlib-5-2/" display-uri="ppxlib-5-2" type="local">bumping the internal AST to 5.2</fr:link>, and whilst I think we are adding a good deal more complexity, it will hopefully keep the ppx universe on an even keel for longer periods of time.</html:p>
                <html:p>The first <fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/607" type="external">substantial PR</fr:link> for this modern world of ppxlib is in review!</html:p>
                <html:p>Aside from that I also debugged an issue that lead to <fr:link href="https://github.com/ocaml-ppx/ppxlib/pull/604" type="external">ppxlib OOM-ing</fr:link> machines... of course, any recursive fold-like loop where the accumulator keeps growing is likely to do that! It was nice to be able to crack out <fr:link href="https://blog.janestreet.com/finding-memory-leaks-with-memtrace/" type="external">memtrace</fr:link> to be able to hunt it down:</html:p>
                <html:img src="/bafkrmignyxory52fgqvdsqxqcd6dfifpiqrerqwcl6lbdy3gbj4ck46zee.png" />
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>5</fr:day>
                </fr:date>
                <fr:title text="Incremental Directory Reading for Eio">Incremental Directory Reading for Eio</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>A common tasks for many a CLI tool is to scan a directory of files, filter out the ones you are looking for and apply some transformation to said files. In fact, that is what <fr:link href="/graft/" title="Graft" uri="https://patrick.sirref.org/graft/" display-uri="graft" type="local">Graft</fr:link> and <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link> both do! A standard approach to this involves a recursive dance of <html:code>readdir</html:code> and <html:code>stat</html:code>, the former lists the entries in a directory whilst the latter lets you know what kind of file is at a particular path (e.g. symbolic link, directory etc.). This has a few downsides:</html:p>
                <html:ol>
                  <html:li>
                    <html:p>We're making <html:strong>two</html:strong> systems calls (pretty much one of the most expensive things your program can do).</html:p>
                  </html:li>
                  <html:li>
                    <html:p>If a directory contains thousands of files, we end up allocating a big list of strings after returning from <html:code>readdir</html:code>.</html:p>
                  </html:li>
                </html:ol>
                <html:p>On Linux, we can get around most of that with <fr:link href="https://linux.die.net/man/2/getdents64" type="external">getdents64(2)</fr:link> which allows us to <html:em>incrementally</html:em> read a directory. Whatsomore, this system call also returns the file type so there's no need to do an extra <html:code>stat</html:code>!</html:p>
                <html:p>I prototyped <fr:link href="https://github.com/ocaml-multicore/eio/pull/821" type="external">an implementation</fr:link> of this called <html:code>Eio.Path.walk</html:code> which looks like:</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-keyword-other">val</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">walk</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language">_</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">File</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Stat</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">kind</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">*</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-support-type">string</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Seq</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">t</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-storage-type">'a</html:span>
                    <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-storage-type">'a</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-comment-doc"><![CDATA[(**]]></html:span>
                    <html:span class="ocaml-comment-doc"><![CDATA[ [walk t] traverses the directory [t] producing a sequence of results.]]></html:span>
                    <html:span class="ocaml-comment-doc"><![CDATA[*)]]></html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <html:p>We effectively halve the number of system calls. In a benchmark that traverse deeply-nested directories with plenty of files, a full traversal whent from <html:code>1.46s</html:code> to <html:code>110ms</html:code>. I have since rejigged the implementation to automatically recurse for the user into subdirectories (not that the signature is unchanged) which does make it tricky to control the number of open file descriptors compared to if the user were in control.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>5</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/icfp-oxcaml-uring/</fr:uri>
                <fr:display-uri>icfp-oxcaml-uring</fr:display-uri>
                <fr:route>/icfp-oxcaml-uring/</fr:route>
                <fr:title text="OxCaml Experiments ">OxCaml Experiments </fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>I have included here a transclusion from my <fr:link href="/icfp-2025/" title="ICFP 2025" uri="https://patrick.sirref.org/icfp-2025/" display-uri="icfp-2025" type="local">ICFP</fr:link> post about an experiment using unboxed 32-bit integers in OCaml's Uring library.</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:uri>https://patrick.sirref.org/oxcaml-and-uring/</fr:uri>
                    <fr:display-uri>oxcaml-and-uring</fr:display-uri>
                    <fr:route>/oxcaml-and-uring/</fr:route>
                    <fr:title text="OxCaml and Uring">OxCaml and Uring</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Jane Street were a big presence at ICFP 2025, carting along with them a shiny new OCaml compiler: <fr:link href="https://oxcaml.org/" type="external">OxCaml</fr:link>. If have been <fr:link href="/try-oxcaml/" title="Try OxCaml" uri="https://patrick.sirref.org/try-oxcaml/" display-uri="try-oxcaml" type="local">playing around with OxCaml recently</fr:link> but nothing outside toplevels in Javascript. Until now!</html:p>
                    <html:p>After talking to <fr:link href="/dra27/" title="David Allsopp" uri="https://patrick.sirref.org/dra27/" display-uri="dra27" type="local">David</fr:link>, I spent some time converting a small corner of the <fr:link href="https://github.com/ocaml-multicore/ocaml-uring" type="external">ocaml-uring</fr:link> library to use a part of <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link>. In particular making the following change:</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">module</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">struct</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">ptr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int32</html:span>
                        <html:span class="ocaml-keyword-other">#</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                        <html:span class="ocaml-comment-block"> ... </html:span>
                        <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">end</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">cqe</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source">user_data_id</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                        <html:span class="ocaml-source">ptr</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">    </html:span>
                        <html:span class="ocaml-source">res</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">int32</html:span>
                        <html:span class="ocaml-keyword-other">#</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>The idea being that a completion queue entry (a notification that some operation has completed) could be fully represented using 64 bits (two 32-bit, <fr:link href="https://oxcaml.org/documentation/unboxed-types/01-intro/" type="external">unboxed values</fr:link>). You can <fr:link href="https://github.com/ocaml-multicore/ocaml-uring/compare/main...patricoferris:ocaml-uring:oxcaml?expand=1" type="external">see how this impacted the library</fr:link>! I'm not certain about this change (and I'm sure I did it wrong) but it was nice to realise <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> gives you this kind of control. However, I am worried about the ergonomics of manipulating values like <html:code>int32#</html:code> and the temptation to case it into an <html:code>int</html:code> (presumably losing a good portion of the value of having an unboxed value in the first place).</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>11</fr:month>
                      <fr:day>5</fr:day>
                    </fr:date>
                    <fr:title text="x-ocaml with OxCaml">x-ocaml with OxCaml</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>I sent <fr:link href="https://github.com/oxcaml/opam-repository/pull/19" type="external">a few PRs</fr:link> to the OxCaml repository to get the toplevel working again and lucky the underlying culprit for why patches were disappearing was found. Watch this space for a new toplevel in the browser soon.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>5</fr:day>
                </fr:date>
                <fr:title text="Geospatial OCaml">Geospatial OCaml</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>In addition to the <fr:link href="/outreachy/" title="Outreachy" uri="https://patrick.sirref.org/outreachy/" display-uri="outreachy" type="local">Outreachy</fr:link> work I mentioned above, I also found the time to keep the <fr:link href="/geocaml/" title="Geocaml" uri="https://patrick.sirref.org/geocaml/" display-uri="geocaml" type="local">Geocaml</fr:link> project ticking along. A few projects saw some much-needed love including:</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>11</fr:month>
                      <fr:day>5</fr:day>
                    </fr:date>
                    <fr:title text="PROJ in OCaml">PROJ in OCaml</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>A <fr:link href="https://github.com/geocaml/ocaml-proj" type="external">modernisation of the bindings</fr:link> to <fr:link href="https://proj.org/en/stable/" type="external">PROJ</fr:link>. PROJ is probably the most used and tested code for working with geospatial projections. Any time you get a sateillite image or a blob of <fr:link href="https://github.com/geocaml/ocaml-geojson" type="external">GeoJSON</fr:link>, the geospatial data will normally have some coordinate reference system (CRS) with it detailing exactly what the numbers that tell you <html:em>where</html:em> something is mean. One of the most common being <fr:link href="https://en.wikipedia.org/wiki/World_Geodetic_System" type="external">WGS84</fr:link> (used by GPS and GeoJSON for example). Each CRS has its benefits and drawbacks, and often you will need to convert between them. That is what PROJ does.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>11</fr:month>
                      <fr:day>5</fr:day>
                    </fr:date>
                    <fr:title text="WKT in OCaml">WKT in OCaml</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Well-known Text (WKT) is a very simple encoding of geospatial objects and CRSs. For example, a polygon might look like:</html:p>
                    <html:pre><![CDATA[Polygon ((10 10, 10 20, 20 20, 20 15, 10 10))]]></html:pre>
                    <html:p>I used <fr:link href="https://ocaml.org/p/bytesrw" type="external">bytesrw</fr:link> to build a <fr:link href="https://github.com/geocaml/ocaml-wkt" type="external">simple codec for the WKT format</fr:link>. It is probably about time to write the basic geospatial object library too, something similar to <fr:link href="https://github.com/georust/geo" type="external">Rust's geo</fr:link> library.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>11</fr:month>
                      <fr:day>5</fr:day>
                    </fr:date>
                    <fr:title text="Geotessera">Geotessera</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>A lot of people in <fr:link href="https://www.cst.cam.ac.uk/research/eeg" type="external">my group</fr:link> are excited about <fr:link href="/tessera2025/" title="TESSERA: Temporal Embeddings of Surface Spectra for Earth Representation and Analysis" uri="https://patrick.sirref.org/tessera2025/" display-uri="tessera2025" type="local">Tessera</fr:link>. They have made it easy to used the Tessera embeddings via a python library called <fr:link href="https://github.com/ucam-eo/geotessera" type="external">geotessera</fr:link>. In true OCaml-at-heart spirit, I tried my hand at <fr:link href="https://tangled.org/@patrick.sirref.org/ocaml-geotessera" type="external">porting this library</fr:link>. I had a good deal of success, converting the data into <fr:link href="https://ocaml.org/p/nx" type="external">Nx array</fr:link>, extracting the CRS and transform out of the GeoTIFF landmasks using <fr:link href="https://github.com/geocaml/ocaml-tiff" type="external">ocaml-tiff</fr:link>, reading datasets using <fr:link href="https://github.com/geocaml/ocaml-geojson" type="external">ocaml-geojson</fr:link> etc. This made me excited but also keen to improve the APIs of most of these libraries too.</html:p>
                    <html:p>I feel <fr:link href="/geocaml/" title="Geocaml" uri="https://patrick.sirref.org/geocaml/" display-uri="geocaml" type="local">geocaml</fr:link> is at a critical mass where we can start to have this useful feedback loop for the libraries because there is enough functionality to actually use them!</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>11</fr:month>
              <fr:day>5</fr:day>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/icfp-oxcaml-uring/</fr:uri>
            <fr:display-uri>icfp-oxcaml-uring</fr:display-uri>
            <fr:route>/icfp-oxcaml-uring/</fr:route>
            <fr:title text="OCaml Roundup: October 2025 › OxCaml Experiments "><fr:link href="/ocaml-roundup-october-2025/" title="OCaml Roundup: October 2025" uri="https://patrick.sirref.org/ocaml-roundup-october-2025/" display-uri="ocaml-roundup-october-2025" type="local">OCaml Roundup: October 2025</fr:link> › OxCaml Experiments </fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>I have included here a transclusion from my <fr:link href="/icfp-2025/" title="ICFP 2025" uri="https://patrick.sirref.org/icfp-2025/" display-uri="icfp-2025" type="local">ICFP</fr:link> post about an experiment using unboxed 32-bit integers in OCaml's Uring library.</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:uri>https://patrick.sirref.org/oxcaml-and-uring/</fr:uri>
                <fr:display-uri>oxcaml-and-uring</fr:display-uri>
                <fr:route>/oxcaml-and-uring/</fr:route>
                <fr:title text="OxCaml and Uring">OxCaml and Uring</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Jane Street were a big presence at ICFP 2025, carting along with them a shiny new OCaml compiler: <fr:link href="https://oxcaml.org/" type="external">OxCaml</fr:link>. If have been <fr:link href="/try-oxcaml/" title="Try OxCaml" uri="https://patrick.sirref.org/try-oxcaml/" display-uri="try-oxcaml" type="local">playing around with OxCaml recently</fr:link> but nothing outside toplevels in Javascript. Until now!</html:p>
                <html:p>After talking to <fr:link href="/dra27/" title="David Allsopp" uri="https://patrick.sirref.org/dra27/" display-uri="dra27" type="local">David</fr:link>, I spent some time converting a small corner of the <fr:link href="https://github.com/ocaml-multicore/ocaml-uring" type="external">ocaml-uring</fr:link> library to use a part of <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link>. In particular making the following change:</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword-other">module</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other">struct</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">    </html:span>
                    <html:span class="ocaml-keyword-other">type</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">ptr</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-support-type">int32</html:span>
                    <html:span class="ocaml-keyword-other">#</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">    </html:span>
                    <html:span class="ocaml-comment-block"><![CDATA[(*]]></html:span>
                    <html:span class="ocaml-comment-block"> ... </html:span>
                    <html:span class="ocaml-comment-block"><![CDATA[*)]]></html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword-other">end</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-keyword-other">type</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source">cqe</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-operator">=</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-source"><![CDATA[{]]></html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">    </html:span>
                    <html:span class="ocaml-source">user_data_id</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-constant-language-capital-identifier">Heap</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-period punctuation-separator">.</html:span>
                    <html:span class="ocaml-source">ptr</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">    </html:span>
                    <html:span class="ocaml-source">res</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                    <html:span class="ocaml-source"> </html:span>
                    <html:span class="ocaml-support-type">int32</html:span>
                    <html:span class="ocaml-keyword-other">#</html:span>
                    <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                    <html:span class="ocaml-source">
</html:span>
                    <html:span class="ocaml-source">  </html:span>
                    <html:span class="ocaml-source"><![CDATA[}]]></html:span>
                    <html:span class="ocaml-source">
</html:span>
                  </html:code>
                </html:pre>
                <html:p>The idea being that a completion queue entry (a notification that some operation has completed) could be fully represented using 64 bits (two 32-bit, <fr:link href="https://oxcaml.org/documentation/unboxed-types/01-intro/" type="external">unboxed values</fr:link>). You can <fr:link href="https://github.com/ocaml-multicore/ocaml-uring/compare/main...patricoferris:ocaml-uring:oxcaml?expand=1" type="external">see how this impacted the library</fr:link>! I'm not certain about this change (and I'm sure I did it wrong) but it was nice to realise <fr:link href="https://patrick.sirref.org/oxcaml/" type="external">OxCaml</fr:link> gives you this kind of control. However, I am worried about the ergonomics of manipulating values like <html:code>int32#</html:code> and the temptation to case it into an <html:code>int</html:code> (presumably losing a good portion of the value of having an unboxed value in the first place).</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>11</fr:month>
                  <fr:day>5</fr:day>
                </fr:date>
                <fr:title text="x-ocaml with OxCaml">x-ocaml with OxCaml</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>I sent <fr:link href="https://github.com/oxcaml/opam-repository/pull/19" type="external">a few PRs</fr:link> to the OxCaml repository to get the toplevel working again and lucky the underlying culprit for why patches were disappearing was found. Watch this space for a new toplevel in the browser soon.</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Related">Related</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>6</fr:month>
              <fr:day>2</fr:day>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/graft/</fr:uri>
            <fr:display-uri>graft</fr:display-uri>
            <fr:route>/graft/</fr:route>
            <fr:title text="Graft">Graft</fr:title>
            <fr:meta name="external">https://github.com/patricoferris/graft</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Graft is a <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link> preprocessor.</html:p>
            <html:p>It takes a forester (a directory of trees) written in a mixture of Markdown, Bibtex and <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link> syntax and produces a new forest completely written in <fr:link href="/forester/" title="Forester" uri="https://patrick.sirref.org/forester/" display-uri="forester" type="local">Forester</fr:link> syntax.</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>6</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:title text="Usage">Usage</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><html:code>graft</html:code> simply preprocesses a forest generating Forester trees from <html:code>.md</html:code>, <html:code>.bib</html:code> and <html:code>.tree</html:code> files. It will copy the structure of the input directory in the output directory.</html:p>
                <html:pre class="hilite">
                  <html:code>
                    <html:span class="sh-source">$ graft preprocess --output=grafted-trees trees
</html:span>
                    <html:span class="sh-source">$ forester build
</html:span>
                  </html:code>
                </html:pre>
                <html:p>This assumes that you have updated your Forester <html:code>toml</html:code> file to put the <html:code>grafted-trees</html:code> directory as your source of trees.</html:p>
                <html:pre><![CDATA[[forest]
trees = [ "grafted-trees" ]]]></html:pre>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>6</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:title text="Example">Example</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>A typical "tree" might look something like</html:p>
                <html:pre><![CDATA[---
title: Opentrace and Supervisions
date: 2025-05-26
author: Patrick Ferris
---

Over the past two weeks I have mainly split my time (amongst many things) developing [opentrace](open-trace)
and doing revision supervisions.

```forester
\put\transclude/numbered{false}
\transclude{open-trace}
```]]></html:pre>
                <html:p>A few things to note:</html:p>
                <html:ol>
                  <html:li>
                    <html:p>The <html:code>yaml</html:code> frontmatter allows you to add some of the metadata fields from Forester.</html:p>
                  </html:li>
                  <html:li>
                    <html:p>At any point in your markdown there is an escape hatch to Forester using a <html:code>forester</html:code> codeblock.</html:p>
                  </html:li>
                </html:ol>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:date>
              <fr:year>2025</fr:year>
              <fr:month>5</fr:month>
              <fr:day>2</fr:day>
            </fr:date>
            <fr:uri>https://patrick.sirref.org/hazel-of-ocaml/</fr:uri>
            <fr:display-uri>hazel-of-ocaml</fr:display-uri>
            <fr:route>/hazel-of-ocaml/</fr:route>
            <fr:title text="A Transpiler from OCaml to Hazel">A Transpiler from OCaml to Hazel</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Over the past few months, I have been piecing together a transpiler from <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> to OCaml. This is, in part, to help one of my third-year undergraduate students who is working on <fr:link href="/part-ii-hazel/" title="Type Error Debugging in Hazel" uri="https://patrick.sirref.org/part-ii-hazel/" display-uri="part-ii-hazel" type="local">type error debugging in Hazel</fr:link>.</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:title text="Typed Holes">Typed Holes</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> is a <fr:link href="/omar-hazel-2017/" title="Hazelnut: a bidirectionally typed structure editor calculus" uri="https://patrick.sirref.org/omar-hazel-2017/" display-uri="omar-hazel-2017" type="local">functional programming language with typed holes</fr:link>. Holes are pieces of your program that have not yet been filled in. Holes can appear anywhere in your program both as expression or types. Hazel can still evaluate your program in the presence of holes.</html:p>
                <html:p>To get a flavour of Hazel, take a regular map function for lists.</html:p>
                <html:pre><![CDATA[let map = fun f -> fun xs -> case xs
  | [] => []
  | x :: xs => f (x) :: map(f)(xs) 
end in
map(fun x -> ?)([1, 2, 3])]]></html:pre>
                <html:p>The question mark (<html:code>?</html:code>) is a hole. The program evaluates to the following expression of type <html:code><![CDATA[[?]]]></html:code> (for people more familiar with OCaml types <html:code>? list</html:code>).</html:p>
                <html:pre><![CDATA[[ ?, ?, ? ]]]></html:pre>
                <html:p>Hazel supports <fr:link href="/zhao-typeerror-2024/" title="Total Type Error Localization and Recovery with Holes" uri="https://patrick.sirref.org/zhao-typeerror-2024/" display-uri="zhao-typeerror-2024" type="local">local type inference</fr:link> but nothing involving unification variables. For example, a simple <html:code>add_one</html:code> function in <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> (<html:code>fun x -&gt; x + 1</html:code>) has type <html:code>? -&gt; Int</html:code>.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:title text="From OCaml to Hazel">From OCaml to Hazel</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>The ability to transpile OCaml programs to Hazel programs is motivated by one simple thought: there are more OCaml programs than there are Hazel programs. This could help bootstrap projects by alleviating the need to rewrite boilerplate code (e.g. URI parsing or standard library functions for strings).</html:p>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="A Transformation of Syntax">A Transformation of Syntax</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Hazel markets itself as an "Elm/ML-like functional programming language". From the previous example of <html:code>map</html:code>, it should be apparent just how close to OCaml the language is.</html:p>
                    <html:p>It turns out that a majority of the transpiler is a <html:em>transformation of syntax</html:em>. Take a simple ADT for an arithmetic programming language.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">type</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Float</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">of</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-support-type">float</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Add</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">of</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Sub</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">of</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Mul</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">of</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-capital-identifier">Div</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">of</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">*</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">expr</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>And when we run <fr:link href="/hazel_of_ocaml/" title="hazel_of_ocaml" uri="https://patrick.sirref.org/hazel_of_ocaml/" display-uri="hazel_of_ocaml" type="local">hazel_of_ocaml</fr:link> over this OCaml type declaration.</html:p>
                    <html:pre><![CDATA[type expr =
  + Float(Float)
  + Add((expr, expr))
  + Sub((expr, expr))
  + Mul((expr, expr))
  + Div((expr, expr))
 in ?]]></html:pre>
                    <html:p>Not much has changed expect some syntax. <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> does not have a notion of top-level expression so <fr:link href="/hazel_of_ocaml/" title="hazel_of_ocaml" uri="https://patrick.sirref.org/hazel_of_ocaml/" display-uri="hazel_of_ocaml" type="local">hazel_of_ocaml</fr:link> wraps the program into one set of value bindings. For the most part, Hazel acts as a subset of the pure, functional part of OCaml. At the time of writing, this subset is fairly limited with no support for modules or labelled records out of the box (there are plenty of development branches with these features).</html:p>
                    <html:p>If we try out the same <html:code>map</html:code> function but written in OCaml and transpiled to Hazel we get.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">rec </html:span>
                        <html:span class="ocaml-entity-name-function-binding">map</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">f</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">xs</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">f</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">x</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">map</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">f</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">xs</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>Which becomes the following hazel program.</html:p>
                    <html:pre><![CDATA[let map = fun f -> fun x1 -> case x1
  | [] => []
  | x :: xs => f(x) :: map(f)(xs)
end in ?]]></html:pre>
                    <html:p>We could have a field day discussing the syntax of OCaml and Hazel (parentheses for function arguments, well-scoped cases for pattern-matching, a different arrow for pattern-matching etc.). What would be more interesting is taking a look at how to handle polymorphism in Hazel.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="Explicit Polymorphism">Explicit Polymorphism</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Hazel has <html:em>explicit polymorphism</html:em>. So far, we have not seen it as we have let the types have holes in them. The <html:code>map</html:code> function in OCaml has the following type.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword-other">val</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">map</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> 
</html:span>
                        <html:span class="ocaml-source">  </html:span>
                        <html:span class="ocaml-source"><![CDATA[(]]></html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'b</html:span>
                        <html:span class="ocaml-source"><![CDATA[)]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'a</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">list</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-storage-type">'b</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">list</html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>We must remind ourselves (by reading <fr:link href="https://www.craigfe.io/posts/polymorphic-type-constraints" type="external">Craig's excellent blogpost on the matter</fr:link>) that in OCaml</html:p>
                    <html:blockquote>
                      <html:p>... type variables in signatures are implicitly universally-quantified</html:p>
                    </html:blockquote>
                    <html:p>So in reality, we have that <html:code>map</html:code> has the following type.</html:p>
                    <html:pre><![CDATA[val map : ∀ a b. (a ->  b) -> a list -> b list]]></html:pre>
                    <html:p>In Hazel, we have to explicitly type our <html:code>map</html:code> function to be polymorphic. Not only does this mean the type annotation requires universally quantified type variables, but we must also perform type application wherever we choose to apply the <html:code>map</html:code> function (whether that be recursively or somewhere later in our program).</html:p>
                    <html:pre><![CDATA[let map : forall a -> forall b -> (a -> b) -> [a] -> [b] =
  typfun a -> typfun b -> fun f -> fun xs -> case xs
    | [] => []
    | x :: xs => f (x) :: map@<a>@<b>(f)(xs) 
end in
map@<Int>@<Int>(fun x -> ?)([1, 2, 3])]]></html:pre>
                    <html:p><html:code>forall</html:code> introduces a universally quantified type variable into our type annotation, and <html:code>typfun</html:code> introduces it into the function itself (à la System F). Type application requires <html:code>@&lt;T&gt;</html:code> where <html:code>T</html:code> is some type. This allows hazel to quite easily support higher rank polymorphism, but we will not worry too much about that.</html:p>
                  </fr:mainmatter>
                </fr:tree>
                <fr:tree show-metadata="false" numbered="false">
                  <fr:frontmatter>
                    <fr:authors>
                      <fr:author>
                        <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                      </fr:author>
                    </fr:authors>
                    <fr:date>
                      <fr:year>2025</fr:year>
                      <fr:month>5</fr:month>
                      <fr:day>2</fr:day>
                    </fr:date>
                    <fr:title text="Propagating OCaml Types into Hazel">Propagating OCaml Types into Hazel</fr:title>
                  </fr:frontmatter>
                  <fr:mainmatter>
                    <html:p>Most often, OCaml users interact with <html:em>prenex</html:em> polymorphism (rank-1) where the universal quantifiers are at the front of the type. <fr:link href="https://ocaml.org/manual/5.2/polymorphism.html#s:higher-rank-poly" type="external">OCaml does support quantifiers inside certain types like records</fr:link>.</html:p>
                    <html:p>What this means for the transpiler is that we can <html:strong>reuse OCaml's type inference</html:strong> to safely instantiate the correct type annotations and type applications in Hazel! To do this, <html:code>hazel_of_ocaml</html:code> uses <fr:link href="https://ocaml.github.io/merlin/" type="external">Merlin</fr:link> to inspect the type of the function in either a value binding or at the point of a function application.</html:p>
                    <html:p>Take a simple, polymorphic <html:code>length</html:code> function.</html:p>
                    <html:pre class="hilite">
                      <html:code>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword">rec </html:span>
                        <html:span class="ocaml-entity-name-function-binding">length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">function</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language-list"><![CDATA[[]]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">0</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other">|</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-language">_</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-other-colon punctuation">:</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">xs</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">-&gt;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">+</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">xs</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">int_len</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">1</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">2</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-constant-numeric-decimal-integer">3</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                        <html:span class="ocaml-keyword">let</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-entity-name-function-binding">str_len</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-keyword-operator">=</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source">length</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[[]]></html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">only</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-keyword-other-ocaml punctuation-separator-terminator punctuation-separator">;</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-string-quoted-double">two</html:span>
                        <html:span class="ocaml-string-quoted-double">"</html:span>
                        <html:span class="ocaml-source"> </html:span>
                        <html:span class="ocaml-source"><![CDATA[]]]></html:span>
                        <html:span class="ocaml-source">
</html:span>
                      </html:code>
                    </html:pre>
                    <html:p>When we run this through <html:code>hazel_of_ocaml</html:code> with the <html:code>-type</html:code> flag we get.</html:p>
                    <html:pre><![CDATA[let length : forall a -> [a] -> Int = typfun a -> fun x1 -> case x1
  | [] => 0
  | _ :: xs => 1 + length@<a>(xs)
end in
let int_len : Int = length@<Int>(1 :: 2 :: [3]) in
let str_len : Int = length@<String>("only" :: ["two"])
in ?]]></html:pre>
                    <html:p><html:code>hazel_of_ocaml</html:code> has correctly instantiated the type for <html:code>length</html:code> inside the recursive function and then in each case with the integer list and the string list.</html:p>
                  </fr:mainmatter>
                </fr:tree>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:title text="A Corpus of Hazel Programs">A Corpus of Hazel Programs</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>The impetus for this work was to derive a corpus of ill-typed Hazel programs. Luckily, such a corpus exists for OCaml! <fr:link href="/ocaml-corpus/" title="A Collection of Novice Interactions with the OCaml Top-Level System" uri="https://patrick.sirref.org/ocaml-corpus/" display-uri="ocaml-corpus" type="local">Seidel et al.</fr:link> created a corpus of OCaml programs from their undergraduate students at UC San Diego. <fr:link href="https://github.com/patricoferris/hazel-corpus" type="external">Some of these programs have been transpiled to Hazel</fr:link>.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2025</fr:year>
                  <fr:month>5</fr:month>
                  <fr:day>2</fr:day>
                </fr:date>
                <fr:title text="Future Work">Future Work</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p><fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> is a fun, research programming language. Potential third-year students may find it interesting to take this work further. For example, how would this look in terms of a module system? From a purely engineering perspective, plenty of work would be needed to convert a multi-library OCaml project to Hazel (e.g. handling the <html:code>cmi</html:code> files).</html:p>
                <html:p>Another line of research would be to have Hazel target one of the intermediate representations in OCaml which would give Hazel a fully functioning compiler to "native" code?</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/anilmadhavapeddy/</fr:uri>
            <fr:display-uri>anilmadhavapeddy</fr:display-uri>
            <fr:route>/anilmadhavapeddy/</fr:route>
            <fr:title text="Anil Madhavapeddy">Anil Madhavapeddy</fr:title>
            <fr:taxon>person</fr:taxon>
            <fr:meta name="external">https://anil.recoil.org</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Professor of Planetary Computing at <fr:link href="/ucam/" title="University of Cambridge" uri="https://patrick.sirref.org/ucam/" display-uri="ucam" type="local">University of Cambridge</fr:link>.</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors>
              <fr:author>
                <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
              </fr:author>
            </fr:authors>
            <fr:uri>https://patrick.sirref.org/bib/</fr:uri>
            <fr:display-uri>bib</fr:display-uri>
            <fr:route>/bib/</fr:route>
            <fr:title text="Bib">Bib</fr:title>
            <fr:taxon>Software</fr:taxon>
            <fr:meta name="external">https://git.sirref.org/ocaml-bibtex</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Bib is a simple Bibtex codec for OCaml. The <fr:link href="https://patrick.sirref.org/software/bib/docs" type="external">documentation is available online</fr:link>. The various <fr:link href="https://patrick.sirref.org/software/bib/releases" type="external">releases are also available online too</fr:link>.</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/forester/</fr:uri>
            <fr:display-uri>forester</fr:display-uri>
            <fr:route>/forester/</fr:route>
            <fr:title text="Forester">Forester</fr:title>
          </fr:frontmatter>
          <fr:mainmatter />
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/mdales/</fr:uri>
            <fr:display-uri>mdales</fr:display-uri>
            <fr:route>/mdales/</fr:route>
            <fr:title text="Michael W. Dales">Michael W. Dales</fr:title>
            <fr:meta name="external">https://digitalflapjack.com</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter />
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/outreachy/</fr:uri>
            <fr:display-uri>outreachy</fr:display-uri>
            <fr:route>/outreachy/</fr:route>
            <fr:title text="Outreachy">Outreachy</fr:title>
            <fr:taxon>Project</fr:taxon>
            <fr:meta name="external">https://www.outreachy.org/</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:blockquote>
              <html:p>Outreachy provides internships in open source and open science. Outreachy provides internships to people subject to systemic bias and impacted by underrepresentation in the technical industry where they are living.</html:p>
            </html:blockquote>
            <html:p>I am one of the coordinators for the <html:em>OCaml community</html:em> for Outreachy. I have also mentored multiple three-month internships for the community.</html:p>
            <html:hr />
            <fr:tree show-metadata="true" expanded="false">
              <fr:frontmatter>
                <fr:authors>
                  <fr:author>
                    <fr:link href="https://patrick.sirref.org/Patrick Ferris/" type="external">Patrick Ferris</fr:link>
                  </fr:author>
                </fr:authors>
                <fr:date>
                  <fr:year>2026</fr:year>
                  <fr:month>2</fr:month>
                  <fr:day>9</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/outreachy-ocaml-tiff/</fr:uri>
                <fr:display-uri>outreachy-ocaml-tiff</fr:display-uri>
                <fr:route>/outreachy-ocaml-tiff/</fr:route>
                <fr:title text="Write support in OCaml TIFF library">Write support in OCaml TIFF library</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>I am mentoring <fr:link href="/tambe-salome/" title="Tambe Salome" uri="https://patrick.sirref.org/tambe-salome/" display-uri="tambe-salome" type="local">Tambe Salome</fr:link> during the December 2025 Outreachy round to add support for writing TIFF files in the <fr:link href="/ocaml-tiff/" title="ocaml-tiff" uri="https://patrick.sirref.org/ocaml-tiff/" display-uri="ocaml-tiff" type="local">ocaml-tiff</fr:link> library.</html:p>
                <html:p>You can now see the video of the demonstration day presentation:</html:p>
                <html:div style="text-align: center">
<html:iframe title="Outreachy Demo Day December 2025 Round" width="560" height="315" src="https://watch.ocaml.org/videos/embed/8aUqMhFvhQGq4WJLH3ukjA?start=1h18m33s" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" />
</html:div>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="true" expanded="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2022</fr:year>
                  <fr:month>12</fr:month>
                  <fr:day>1</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/topojson-0001/</fr:uri>
                <fr:display-uri>topojson-0001</fr:display-uri>
                <fr:route>/topojson-0001/</fr:route>
                <fr:title text="Implement a non-blocking, streaming codec for TopoJSON">Implement a non-blocking, streaming codec for TopoJSON</fr:title>
                <fr:meta name="external">https://github.com/geocaml/ocaml-geojson</fr:meta>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>GeoJSON is a JSON standardised format for handling simple geographical data. One common use of GeoJSON is to add map overlays such as with the popular JavaScript library leaflet. One issue with GeoJSON is redundant data, for example when two polygons share boundaries ideally only one would contain the full data about the boundary, however, with GeoJSON the data is duplicated.</html:p>
                <html:p>TopoJSON is an extension to GeoJSON to encode topology. This allows for redundant data to be removed and file sizes to be greatly reduced. This is often very desirable especially when working with data in the browser. In a previous Outreachy internship a new OCaml library was implemented to provide an OCaml library for TopoJSON, this project will build on this adding more functionality to the library and providing a non-blocking, streaming codec version similar to the geojsone library.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="true" expanded="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2022</fr:year>
                  <fr:month>6</fr:month>
                  <fr:day>1</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/topojson-0002/</fr:uri>
                <fr:display-uri>topojson-0002</fr:display-uri>
                <fr:route>/topojson-0002/</fr:route>
                <fr:title text="Extend OCaml's GeoJSON library to support TopoJSON">Extend OCaml's GeoJSON library to support TopoJSON</fr:title>
                <fr:meta name="external">https://github.com/geocaml/ocaml-geojson</fr:meta>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>GeoJSON is a JSON standardised format for handling simple geographical data. One common use of GeoJSON is to add map overlays such as with the popular JavaScript library leaflet. One issue with GeoJSON is redundant data, for example when two polygons share boundaries ideally only one would contain the full data about the boundary, however, with GeoJSON the data is duplicated.</html:p>
                <html:p>TopoJSON is an extension to GeoJSON to encode topology. This allows for redundant data to be removed and file sizes to be greatly reduced. This is often very desirable especially when working with data in the browser. In a previous Outreachy internship a new OCaml library was implemented to provide an OCaml library for TopoJSON, this project will build on this adding more functionality to the library and providing a non-blocking, streaming codec version similar to the geojsone library.</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="true" expanded="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:date>
                  <fr:year>2021</fr:year>
                  <fr:month>6</fr:month>
                  <fr:day>1</fr:day>
                </fr:date>
                <fr:uri>https://patrick.sirref.org/ocamlorg-0001/</fr:uri>
                <fr:display-uri>ocamlorg-0001</fr:display-uri>
                <fr:route>/ocamlorg-0001/</fr:route>
                <fr:title text="Improve the ocaml.org Website">Improve the ocaml.org Website</fr:title>
                <fr:meta name="external">https://ocaml.org</fr:meta>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>OCaml.org is the main website for OCaml, a functional, typed, high-level programming language. This project revolves around improving the website on multiple different fronts including: layout, accessibility and content.</html:p>
                <html:p>Because a lot of the content of the website is about OCaml and the website itself is written in OCaml, this would be a great opportunity for interns to learn the language and functional programming concepts.</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/ryangibb/</fr:uri>
            <fr:display-uri>ryangibb</fr:display-uri>
            <fr:route>/ryangibb/</fr:route>
            <fr:title text="Ryan Gibb">Ryan Gibb</fr:title>
            <fr:meta name="postion">PhD Student and Nix Guru</fr:meta>
            <fr:meta name="external">https://ryan.freumh.org</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>Fellow <fr:link href="https://github.com/fn06" type="external">FN06</fr:link> hacker.</html:p>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/shelter/</fr:uri>
            <fr:display-uri>shelter</fr:display-uri>
            <fr:route>/shelter/</fr:route>
            <fr:title text="Shelter">Shelter</fr:title>
            <fr:meta name="external">https://tangled.sh/@patrick.sirref.org/shelter</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>A shim between a user and the shell that provides greater reproducibility and insight into what your code is doing!</html:p>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:title text="Give me Shelter!">Give me Shelter!</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Shelter combines the caching and reproducibility of Dockerfiles with the ease of interaction of the shell. I'd be interested to use <fr:link href="/ryangibb/" title="Ryan Gibb" uri="https://patrick.sirref.org/ryangibb/" display-uri="ryangibb" type="local">Ryan</fr:link>'s <fr:link href="https://ryan.freumh.org/research.html" type="external">package management work</fr:link> as a means to specify the base environment users want.</html:p>
                <html:p>Here is an example of running Shelter and making use of the branchable sessions.</html:p>
                <html:pre class="ansi2html-content"><html:span class="ansi33">shelter&gt; </html:span>echo hello &gt; hello.txt
<html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">main</html:span>#<html:span class="ansi35">bbd691a</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> @ session exp-1]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">exp-1</html:span>#<html:span class="ansi35">bbd691a</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> echo world >> hello.txt]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">exp-1</html:span>#<html:span class="ansi35">dd5bab8</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> @ session main]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">main</html:span>#<html:span class="ansi35">bbd691a</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> echo "to the" >> hello.txt]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">main</html:span>#<html:span class="ansi35">b9abef4</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> cat hello.txt
hello
to the]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">main</html:span>#<html:span class="ansi35">d1c1728</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> @ session exp-1]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">exp-1</html:span>#<html:span class="ansi35">dd5bab8</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> @ replay main]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">exp-1</html:span>#<html:span class="ansi35">df1b4e1</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }> cat hello.txt
hello
to the
world]]><html:span class="ansi33">shelter</html:span><![CDATA[[]]><html:span class="ansi32">exp-1</html:span>#<html:span class="ansi35">67162b7</html:span><![CDATA[] : { mode:]]><html:span class="ansi31">rw</html:span><![CDATA[ }>]]></html:pre>
                <html:p>The <html:code>@</html:code> character allows the user to interact directly with Shelter's build-in operators. <html:code>@ session exp-1</html:code> creates a new session as there is no <html:code>exp-1</html:code> session. It points to the head commit of the branch it came from (<html:code>git checkout -b exp-1</html:code>).</html:p>
                <html:p>From there we make changes and switch between branches until we perform a replay. A replay is a rebase without any merge conflict checks, it simply finds the <html:em>least common ancestor</html:em> of the two branches and re-applies the commits from your current branch (here <html:code>exp-1</html:code>) onto the head of the target branch (here <html:code>main</html:code>).</html:p>
              </fr:mainmatter>
            </fr:tree>
            <fr:tree show-metadata="false" numbered="false">
              <fr:frontmatter>
                <fr:authors />
                <fr:title text="Under the hood">Under the hood</fr:title>
              </fr:frontmatter>
              <fr:mainmatter>
                <html:p>Shelter is a light-weight, reimplementation of <fr:link href="https://github.com/ocurrent/obuilder" type="external">obuilder</fr:link>. It uses the similar ideas, like snapshotting filesystems (e.g. <fr:link href="https://github.com/patricoferris/ocaml-zfs" type="external">ZFS</fr:link>) and Linux namespaces (e.g. <fr:link href="https://github.com/quantifyearth/void" type="external">Void</fr:link>). Between the low-level store and the interactive shell parts, there is an <fr:link href="https://github.com/mirage/irmin" type="external">Irmin</fr:link> store.</html:p>
              </fr:mainmatter>
            </fr:tree>
          </fr:mainmatter>
        </fr:tree>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://patrick.sirref.org/part-ii-hazel/</fr:uri>
            <fr:display-uri>part-ii-hazel</fr:display-uri>
            <fr:route>/part-ii-hazel/</fr:route>
            <fr:title text="Type Error Debugging in Hazel">Type Error Debugging in Hazel</fr:title>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:blockquote>
              <html:p>This project will add some features to the <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> language. <fr:link href="/hazel/" title="Hazel" uri="https://patrick.sirref.org/hazel/" display-uri="hazel" type="local">Hazel</fr:link> is a functional research language that makes use of gradual types to support unusual features such as: holes (code place-holders) to give type meaning to incomplete programs. Importantly for this project, all Hazel programs, even ill-typed or incomplete programs, are evaluable. This allows dynamic reasoning about ill-typed programs via evaluation traces with the potential to improve the user’s understanding of why ill-typed programs go wrong.</html:p>
              <html:p>This project aims to exploit further this potential by providing some extra features to both: aid with finding values/inputs that demonstrate why type-errors were found (type-error witnesses) and linking the evaluation traces back to source code.</html:p>
            </html:blockquote>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Contributions">Contributions</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
  </fr:backmatter>
</fr:tree>
