a haskellian blog
a purely functional...blog?
Welcome! This is the first post on conditional finality and also one that tests all of the features.
A monad is just a monoid in the category of endofunctors, what’s the problem?
haskell?
This entire blog is generated with hakyll. It’s a library for generating static sites for Haskell, a purely functional programming language. It’s a library because it doesn’t come with as many batteries included as tools like Hugo or Astro. You set up most of the site yourself by calling the library from Haskell.
Here’s a brief excerpt:
main :: IO ()
= hakyllWith config $ do
main
forM_"CNAME"
[ "favicon.ico"
, "robots.txt"
, "_config.yml"
, "images/*"
, "out/*"
, "fonts/*"
,
]$ \f -> match f $ do
route idRoute compile copyFileCompiler
The code highlighting is also generated by hakyll.
why?
Haskell is a purely functional language with no mutable state. Its syntax actually makes it pretty elegant for declaring routes and “rendering” pipelines.
- Haskell is cool.
- It comes with enough features that I don’t feel like I have to build everything from scratch.
- It comes with Pandoc, a Haskell library for converting between markdown
formats. It’s probably more powerful than anything you could do in
nodejs
. It renders all of the markdown to HTML as well as the math.- It supports KaTeX as well as MathML. I’m a little disappointed with the KaTeX though. It doesn’t directly render it, but simply injects the KaTeX files and renders it client-side.
speaking of math
We can have math inline, like so: . This site ships semantic MathML math with its HTML, and the MathJax script to the client.
It’d be nice if MathML could just be used and supported across all browsers, but unfortunately we still aren’t quite there yet. Firefox is the only one where everything looks 80% of the way to LaTeX. On Safari and Chrome, even simple equations like render improperly.
Pros of MathML:
- A little more accessible
- Can be rendered without additional stylesheets. I just installed the Latin Modern font, but this isn’t even really necessary
- Built-in to most browsers (#UseThePlatform)
Cons:
- Isn’t fully standardized. Might look different on different browsers
- Rendering quality isn’t as good as KaTeX
This site has MathJax render all of the math so it looks nice and standardized across browsers, but the math still displays regardless (like say if MathJax couldn’t load due to slow network) because of MathML. Best of both worlds.
Let’s try it now. Here’s a simple theorem:
The proof is trivial and will be left as an exercise to the reader.
seems a little overengineered
Probably is. Not as much as the old one, though.