Revisiting Link’s Awakening

Late last year, Nintendo released a remake of The Legend of Zelda: Link’s Awakening for the Switch. I only got a few days of gameplay out of it at the time. Over the last week, in an attempt to find some reprieve during Melbourne’s grinding COVID lockdowns, I sat down and re-played the game from the beginning, all the way to 100% completion (all heart pieces, seashells and trophies).

Comparing the Australian population and electorate by age

A couple of weeks ago there were a few points made on Twitter about the extent to which Australia’s parliament reflects the diversity of Australia’s population. I thought it might be interesting to iterate on that question a bit, and do some poking around about the extent to which the Australian electorate is representative of its population. Further to that, I wonder whether our parliament is more reflective of the electorate than the population.

Talking about laws for the REA FP guild

In July 2020 I gave a presentation at the functional programming guild for my employer REA Group. The talk involved slowly building a type class hierarchy extending from semigroup. Each additional step added the laws required by the child type class.

Defining an Ordering for java.time.Period

I’ve written a library called intime, which provides exhaustive integration between the classes in the java.time library and some common Scala libraries. The most interesting problem I encountered was defining an Ordering (or an Order for Cats) for the java.time.Period class. Because months and years cannot simply be expressed as a number of days, This post will discuss those issues.


In my previous post, I discussed using Invariant to add behaviour to value classes. Unfortunately, Invariant is not powerful enough to provide instances for higher-kinded type classes like Functor or Traverse. In this post, I’ll introduce InvariantK, a type class I’ve written to solve this limitation.

Type class instances for value classes with Invariant

Previously I discussed about the advantages of wrapping common types like Int or String in a value class. This allows us to encode more semantic meaning into our types, and means we can use the compiler to check for a number of bugs. In this post I’ll discuss how we can use the Invariant type class to selectively surface functionality from the underlying type for our value class.

Value classes

One of the most valuable techniques I’ve learned from strongly-typed functional programming is value classes. By wrapping common types in specialised case classes, we can improve semantic clarity and leverage compile-time checks to avoid bugs.