I made my first Unison library: units!

Check it out here: @yoching/units

Motivation

I like Units and Measurement in Swift, and I’ve used it in my past projects. Inspired by this, I wanted to create something similar in Unison!

How it works

You can explore the library on Unison Share.

Impressions of the Unison workflow

What I liked

  • Refactoring and renaming are super easy on term/function level
  • edit.namespace command is very helpful. At first, I found it challenging to navigate and search within the codebase. Learning the edit.namespace command made it much easier!

Challenges

  • I had to workaround the absense of typeclass.
  • Writing docs was sometimes a little complicated. In some cases, I found it difficult to make docs compile.
  • Despite renaming functions/terms are very easy, renaming terms inside functions is not that easy when the AST doesn’t change. I sometimes had to change the AST a bit just to rename some terms.

Despite a few challenges, the overall experience of building a library in Unison was great, very interesting, and fun!