Skip to content

Blog

Why Traversable Requires Applicative at Least

At the beginning, the blog name is why traversable requires applicative. However, later I feel like it is nonsense and just repeating the sentence to describe the traversable. It requires applicative of course because it uses that. As a result, I changed blog name because in this blog, we will learn about how the traversable uses applicative and why it requires applicative at least.

You should be familiar with Foldable before reading this blog, and I recommend you to read my previous blog why foldable requires monoid at least

In short, applicative is needed as we need to lift the chosen operator, pure the default value and keep applying by Foldable function foldr.

Go Reflect: Correctly Get an Empty Interface Type

This blog records the tricky part of using reflect to get an empty interface type correctly. The background is that a component requires the configuration type during function call as it might use the type to construct a type and set up the value based on some external data set. If we cannot find a respective in some scenarios, empty interface type should be passed.

However, at the beginning due to the wrong usage of reflect, a nil type instead of interface{} type is passed by reflect.TypeOf(i).

var i interface{}
// this is correct
typ := reflect.TypeOf(&i).Elem()

// this is wrong usage, the typ is nil
typ := reflect.TypeOf(i)

Migration from Docker to OrbStack

Recently, my company abandoned docker desktop because it requires the company to paid for its services. As a result, the company treats as an unnecessary cost and asks the developers to find another alternatives. This blog records the troublesome during my migration.