Announcing Ema - Static Sites in Haskell

tldr: Announcing Ema, a new static site generator in Haskell with hot reload destined to develop an unique kind of apps. This post mostly goes over the background of choosing to create it.

A little over a year ago I created the rib static site generator in Haskell based on Shake and ghcid. The idea was to be able to write a more intuitive (so no Makefile-like rules) set of instructions for building a static site, in a type-safe language while enabling quick recompilation cycle that ghcid provided, all made reproducible in Nix.

Later that year I built Neuron (note-taking system and for publishing for Markdown files as a static site) on top of rib and announced it (see Announcing Neuron - Zettelkasten in Haskell). Neuron has the ability to monitor changes to Markdown files and update the static site. After modifying your notes you would however have to manually refresh the browser.

I explored the idea of hot-reloadโ€™ing the notebook view instantly on Markdown file change in ka Project. You can see a video demo of it here. Likewise, the emanote.obelisk Project โ€“ another brief exploration โ€“ also supported hot reload. But both these projects were not static sites, and they were built on Reflex-FRP and Obelisk. I also recently got to play with SvelteKit for creating static sites, and its hot reload feature in particular impressed me; however Iโ€™m no fan of using a less safe language (see No JavaScript), so I wanted to take the best aspects of these projects and prototype something in Haskell. 1

I decided to meld the ideas explored in the aforementioned projects and thereby create a more general static site generator that supports hot-reload as well as enables creation of applications like Neuron. Today Iโ€™m announcing it: Ema. Hereโ€™s a quick demo:

The project website is generated by Ema itself. You can hack on it locally with IDE support by using the source here.

It is worth emphasizing that I designed Ema to facilitate a new model of application development โ€“ one where the data is managed and edited outside of the application itself (such as in text editors, or even a database), but the view of the data is provided by the application. Neuron is a great example of that (and it might well be eventually rewritten on top of Ema; EDIT: indeed it is). Another example is writing a diary / journal view on top of Org Mode daily notes, which is what Iโ€™m exploring in the orgself project that also uses Ema. A third example is to take a OPML file and present a daily-digest view of new content from the RSS feeds; the application would provide only a โ€œviewโ€ into your data, which is a XML file that you may edit however you see fit. I like this model of apps, because the data and the data format remains under my control, all the while yet Iโ€™m not limited when it comes to presentation of that data, and I think the web is a great platform for the later.

At first I attempted to do it in F#; see A brief F# exploration.
Links to this page