Shorter things. Links, observations, photos. Things that don't need a full article but are worth writing down.
A few days ago I announced Garanti
on the Gleam Discord. It did not receive too many comments, but out of the few it seems that people like assert x == y
over custom matchers.
I like (my) matchers though, and maybe I phrased the USP badly in my post and in the README.
I have started to use Garanti in my (yet) private Gleam project. And Garanti makes it very easy to add custom matchers that behave just like the built-in matchers, both when calling and how failures are reported!
import garanti
import gleam/list
import gleam/string
/// Asserts that a string contains a given substring.
pub fn to_contain_string(
actual: String,
substring: String,
) -> garanti.AssertionResult {
case string.contains(actual, substring) {
True -> garanti.Pass
False ->
garanti.Fail(
"Expected string to contain " <> string.inspect(substring) <> ".",
[garanti.Actual(actual), garanti.Expected(substring)],
)
}
}
A test would then fail with this message (using ANSI colours):
Test an unexpected error includes the raw detail:
Expected string to contain "port error".
Actual: Could not start due to an obscure error.
Expected: port error
This needs to be better communicated and exemplified in the README. Because, what I think makes a test clear is a 50/50 split between reading the test code and reading the test failure message. Here I think custom matchers has an advantage!
I have been working on my Gleam test-framework, Garanti, recently. It now supports both Erlang and JavaScript targets!
import garanti.{Suite, Test}
import garanti/expect
pub fn math_suite() -> Suite {
Suite("math", [
Test("should add two numbers", fn() {
math.add(2, 2)
|> expect.to_be_equal(4)
}),
Test("should divide by two", fn() {
use result <- expect.to_be_ok_then(math.divide(4, 2))
expect.to_be_equal(result, 2)
})
])
}
The next feature is to add support for richer assertion messages. A single string is too limited, so I need to add something with a bit more structure. Then it might be time to release it on hex.pm.
Check it out at Garanti.
Yesterday I watched the Clojure Documentary which I think was wonderful. Rich and the community around Clojure seems like such a nice place that I instantly get keen on revisiting Clojure.
I did some programming in Clojure back in 2013 and I quite like it. But at that point in time I enjoyed dynamically typed languages. Today I value type-safety very highly. So, maybe it is time to challenge myself and use Clojure again for something?
Even if you do not use Clojure, I recommend you to watch the documentary. It is an interesting piece of computer science history nonetheless.
My new project Albumklubben (Swedish for "The Album Club") is progressing nicely!
This is a project I have started several times but never finished. It is one of these projects that you spend an unreasonable amount of time thinking about, but that might never take off.
What is it? It is a small social network for music lovers. I used to have a Facebook group that took turns pitching an album every week. I am rarely on Facebook any more, and this is a great excuse to build something new!

The club will start invite only, and, as you can see, in Swedish (as I enjoy quite a lot of Swedish music).
Inspired by this blog, I decided to also add a shoutbox to my site. It is wired to a Telegram bot on my phone, which turned out to be super simple and free!
Silly me, I thought I needed to jump through the hoops to host a mail server.
This will be sent straight to me. There is no validation, no captcha, no tracking, no reply address - so please be kind ♥️