My main motivation was to try out generics in Go. I jumped straight into the usual suspects: Filter
and Map
. When testing these, I saw the need for assertion functions: another opportunity to exercise some more generics! It is now part of this ext-lib under lives as an testing/assert.
Later I thought it would be nice to implement Set
, and then HashMap
, with which I got carried away and ended up implementing a somewhat naïve hasher (you can read more on the rationale on this commit).
When I realized, I was already having fun with Maybe
, Either
and Result
. Here is where I stumbled upon some limitations of Go generics. Right when I was experimenting with it, I came across a blog post by @hypirion titled "Type-Safe HTTP Servers in Go via Generics" where the author bumps into these same limitations.
When writing software in Go, I've always wanted slightly higher level constructs, especially to represent business domain concepts. Some may say I haven't fully embraced Go. Perhaps I haven't 🤷. But I sure know people who'd also like to go up in abstraction a tad bit.
Hope this is enough motivation… 😅
🚧 This section is a work in progress.
Gopher: gopherize.me