From a non-theoretical engineer perspective, a monad is a kind of container that you can apply functions to to get a new monad. In particular, you need a way to put something into your monad and a way to apply changes to it. These are called return
and bind
. There is also a third operation, map
, which is a combination of the two. Note that monads are allowed to be empty, which will make bind
and map
not do anything; and they can also contain more than one thing (in which case bind
and map
will call the function you give them more than once and merge the results).
ZIP vs tar for compressed archives
I've been working on an OCaml library to read XLSX files, and something I thought was odd is that all strings in an Excel workbook are listed in a "shared strings" file and then referenced by index. This seemed strange to me, since I would expect the compression algorithm to do this kind of work for you, but thinking about it made me better understand why that's necessary, and also what the advantages and disadvantages of the ZIP and tar + compression formats are.
OCaml operator cheatsheet
One of the hardest parts of learning OCaml is figuring out what the infix operators do, since they're just a string of symbols and you can't find them with a Google search. This is my attempt to make a cheatsheet for whenever you're wondering what a random series of symbols means.
Replacing computer setup with Ansible
I've been keeping a computer setup page on my website for a while, describing the exact steps needed to make a computer work how I want after a new OS install. I've also had a note there for years saying eventually I should use Ansible for this. This weekend I finally got around to it, and learned a little bit about Ansible while I was at it.
How to buy a mattress online (with reviews)
My girlfriend and I both replaced our mattresses this fall. Because we have different sizes of mattresses and different preferences, and neither of our first picks worked for us, I ended up trying out almost all of the popular online mattresses. I also spent some time learning about mattresses before making my second pick, so this post will be a guide to how to pick a mattress, with some specific advice regarding the mattresses we tried.