Re:New case studies about Google’s use of Go
by c-cube on Thursday August 27, 2020 @05:20PM
(#24298817)
This is a product, not a sum. It's just a pair of Reader and Writer. Sum types would also give you the ability to say "reader or writer" and use pattern matching to find out which one you were given.
C-like languages traditionally give only the 'product' half of types (C also gives union but they're super low level, and Go just eschewed them). A _modern_ language would give both products and sums.
The most common case I happen to have run across is the result of parsing data or configuration files; situations where there might be structure, but all of it is optional.
PS: Your "algebraic data types / sum types" sounds very much like interface composition, a ReaderWriter ( E.G. https://golang.org/pkg/io/#ReadWriter ) for example composes interface types.