3 ms·
Author here With generics coming in go 1.18, we can finally make a sum type abstraction that is a bit friendlier than the previous alternatives. Obviously hav
by lawrjone 5y ago
Author here
With generics coming in go 1.18, we can finally make a sum type abstraction that is a bit friendlier than the previous alternatives.
Obviously having this in the language would be best, but just having a construct that can check you've handled each case is a big improvement in my mind.
- slaymaker1907 5y agoWhy not just use the visitor pattern? Sum types are obviously better, but the Church encoding for sum types is clunkier than visitors in my opinion.