2 ms·
> Suppose we talk about tagged unions specifically, would it be conceivable to just nominate one variant as the default variant? My experience with Go is just
by jim-jim-jim 2y ago
> Suppose we talk about tagged unions specifically, would it be conceivable to just nominate one variant as the default variant?
My experience with Go is just as recent as yours, and I'm happy to eat shit if I'm completely off base here, but my interpretation is that a tagged union with two instances like
Some a | None
would have to be implemented with underlying standalone `Some` and `None` types, and that `Some` itself would still require an empty representation, which is strange.
Compared to Haskell, where for
Maybe a = Just a | Nothing
the two instances are only (de)constructors, and there is no actual type `Just`.
- lmm 2y ago> would have to be implemented with underlying standalone `Some` and `None` types, and that `Some` itself would still require an empty representation, which is strange. It's not that strange. That's the normal way to model these things in OO languages, and while it's obviously not ideal, it's not completely awful either.