In the same vein, it's a bit of a shame that every collection type has to declare its own empty value.
Obviously, an empty list is different from an empty tree and different from an empty `Maybe` and so on.
However this feels pretty much like a polymorphic value. If you do type-directed name clarification you can call all the empty value constructors one thing as a convention and then (get this) you understand from context which one you meant, same as how mempty works, except not really polymorphic.
@trickster wait, why not just make a typeclass that provides a polymorphic `empty`? then you have an actual thing that represents an empty generic collection, rather than your convention.
@Vierkantor Aesthetically, you still need to call the actual value constructor of the instance something unique, and one of the niceties of this is that you don't have to, you can just call them all `Nil` or w/e.
That aside, this flows naturally from the top-post feature (type dispatched functions) because value constructors are (at least) conceptualized as functions. The idea that this should work for nullary constructors which are decidedly not functions is what prompted the second post.
@Vierkantor of course, the benefit of your suggestion is that i could do it here and now without waiting for this to come along 😅
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!