Alternatives to sum types in Go

1 · Pusher · Jan. 25, 2018, midnight
Many statically typed programming languages, such as Haskell or Swift, have a feature called “sum types”. Sum types (also known as tagged unions or variant types) allows a new type to be defined as the “union” of a set of other types and values, and allows users to “pattern match” on values to find out the underlying type. But Go, the predominant language used at Pusher, does not support sum types. As former Haskell users, we miss them so we wanted to describe some workarounds and alternative ap...