Jasper Van der Jeugt writes about Haskell and is the author of Hakyll, a Haskell static site generator.
HN commenters recommend Hakyll to people choosing a static site generator, calling it powerful and the best option for functional programming fans, though not easy to start.
Thanks. I do not have a public, detailed description of how my blog works. But in short, my site build system is powered by a Makefile that invokes Hakyll [1]. My Hakyll configuration has the following rule baked into it for generating HTML docs from Markdown docs in the `posts/` directory:
match "posts/*" $ do
route $ setExtension "html"
let ctx = postCtx tags
compile $ pandocMathCompiler
>>= loadAndApplyTemplate "templates/post.html" ctx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/add-comments.html" ctx
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls
The `pandocMathCompiler` bit invokes Hakyll's Pandoc subsystem with support for rendering formulas using MathJax.
The site Makefile also has rules to build PDF versions of the articles that I want to typeset. The rules just invoke Pandoc directly. For example, here's the rule used to generate the PDF file in my prior comment:
sampling-with-sql.pdf: posts/2024-08-23-sampling-with-sql.md
( cd posts && pandoc --metadata-file=../templates/latex-header-includes.yaml -t pdf -o ../$@.tmp --pdf-engine=pdflatex ../$< && mv -f ../$@.tmp ../$@ )
It's basically a straightforward invocation of Pandoc with a little shell boilerplate to prevent the PDF file from being moved into its final location unless Pandoc exits with success.
The Makefile has a final "push" target that makes sure the…
> No standard and easy way of implementing interfaces.
> In Haskell, this is done with typeclasses ...
> In OCaml there’s no way to do this. I have to explicitly pass functions along with my values, maybe in a product type, or with a functor, or as an argument.
Haskell is a mixed community / paradigm language too.
I routinely program in "Braindead Haskell" (keep stuff simple and direct as much as possible). Funnily, in that programming style, using typeclasses for _all_ interface types is bad style.
Instead, the Handle pattern [0] can be used. Which really is just shoveling functions in a product type. And imagine - it works worderfully.
Everyone has to find their own style I guess.
[0]: https://jaspervdj.be/posts/2018-03-08-handle-pattern.html
In case anyone is curious about the tech:
I'm using Hakyll (https://jaspervdj.be/hakyll/index.html) to generate the static website and https://github.com/jaspervdj/hakyll-citeproc-example for reference handling (but adapted so that I have a ".bib" file per blog post).
The reference handling was really painful when I tried to do it manually at first, but hakyll-citeproc has made it really easy. A lot of websites let you download a "citation" (in bibtex format) so you can just copy & paste it in your ".bib" file. For others, I use https://www.bibme.org/bibtex to generate one.
For deploy, I use a simple deploy script (4 lines of code) that pushes it up to an amazon s3 bucket and clears the Cloudfront cache.
plenty of projects that use either of the following on a regular basis:
- https://www.aosabook.org/en/posa/warp.html
- https://morpheusgraphql.com/
- https://higherkindness.io/mu-haskell/
- https://github.com/hasura/graphql-engine
- https://postgrest.org/en/stable/
- https://www.shellcheck.net/
- https://dhall-lang.org/
- https://haskell-miso.org/
- https://github.com/jgm/gitit
- https://jaspervdj.be/hakyll/
- https://github.com/IHaskell/IHaskell
- https://tweag.github.io/HaskellR/ (https://idontgetoutmuch.wordpress.com/2018/05/19/cartography-in-haskell/)
The list can go on, it really depends on what level of "real-worldness" you consider to be real.
As far as mechanics go, I've found a great compromise between the power and convenience of a CMS and the simplicity of a static page: using a static site generator. I personally prefer Hakyll[1], as you might have guessed :P.
This makes managing a structured site easy without having to configure a complicated server. Of course, it also means you can't have much dynamic content. For something simple--say comments--you could use an external service like Disqus, but you won't be able to do much beyond that without running your own server.
[1]: http://jaspervdj.be/hakyll/
The author's site appears to be built using Hakyll https://jaspervdj.be/hakyll/, which is a Haskell static site generator. You can find the source for this particular site on Github: https://github.com/barrucadu/barrucadu.co.uk
The "clean look" you refer to is mostly thanks to custom CSS though - nothing specifically related to Hakyll.
If you're thinking about building a similarly-styled blog or personal site, you could start by studying the styles this author used on their site: https://github.com/barrucadu/barrucadu.co.uk/tree/master/css