First Blog Post

Posted on January 27, 2013
Tags: haskell, hakyll

I decided that I should have a blog. I like the idea of static site generators, so I looked at several, such as nanoc and OctoPress, but I eventually settled on Hakyll. In part, this is because I am trying to learn Haskell, so I thought it would be good for me. But also, Hakyll seems to have a good feature set.

I’m pleased so far, because the default template, although minimal, is quite usable, and I’ve been able to start writing this post and preview it with minimal fuss. Awesome! No need to futz with a lot of HTML and CSS!

(A friend of mine once implied that anyone who doesn’t write posts directly in HTML, and uses a more human-friendly language like Markdown, such as I am doing right now while writing this post, is somehow wimpy and not computer-savvy. I disagree. HTML, although technically human-readable and human-writable, is not a very human-friendly language. Way too many angle brackets, for one thing. So I think of writing in HTML like writing in assembly language, and writing in Markdown like writing in a higher-level language. It lets me focus on what I actually have to say. Hey, at least I’m not using some godawful WYSIWYG composer and database-based CMS.)

Now I just need to figure out where to host this thing. Since I have a static IP address (two, in fact, so there) and an ISP that allows running servers (even if it has gone downhill a bit recently), I’m tempted to just run a server on one of the computers in my living room. And my temptation is to use a server like Yaws or Mighttpd, rather than the more traditional Apache or NGINX. No matter how well-written, well-tested, and widely-deployed they may be, I just have an aversion to the idea of network-facing code being written in C. I really think that in the 21st century, we ought to be using memory-safe languages.

But, since my DSL is rather slow, and I’ve had issues getting my ISP to sell me a faster connection (that’s an issue for a whole other blog post), perhaps I shouldn’t host it out of my living room. Plus, there are always security concerns if I am hosting it on my own machine. So, perhaps I should look at various hosting companies.

There’s also the question of whether to use something like Cloudflare. On the one hand, I’m somewhat resistant to the notion of “the cloud,” and like to be in control of things as much as possible. On the other hand, their service sounds cool, and especially if I host out of my living room, the caching and security benefits seem worthwhile.

Anyway, this is looking like an awesome first post, and I am very happy with Hakyll so far. But, before I close, I want to try out including some code fragments in this post, and see how syntax highlighting works.

#!/usr/bin/runhaskell

import System.Entropy
import Data.Binary.Get
import qualified Data.ByteString.Lazy as B

main = do
  bytes <- getEntropy 4
  print (runGet getWord32be $ B.fromChunks [bytes])

Cool! Haskell highlighting works, after grabbing a css file. Now let’s try another language:

#include <sys/time.h>
#include <stdio.h>

int main (int argc, char **argv)
{
  printf ("%zd\n", sizeof (struct timeval));
  return 0;
}

Okay, looks good. I am happy with my new static blog!