BurntSushi/go-sumtype
View on GitHub ↗ ★ 454 Go
A simple utility for running exhaustiveness checks on Go "sum types."
16 mentions on Hacker News by 10 people: 1 story, 15 comments · first 2017-03-20 · latest 2024-11-18
20082026
-
…intersection of operations they all support. If you want a sum type in Go, use closed interfaces: https://github.com/BurntSushi/go-sumtype If you're willing to accept what you've written as a sum type, you should be even more willing to…
comment by jerf · 2024-11-18 · in Constraints in Go -
…get exhaustiveness checking at compile time, unless you adjoin a linter to your compile process: https://github.com/BurntSushi/go-sumtype
comment by jerf · 2023-09-29 · in Compile-time safety for enumerations in Go -
…exhaustiveness checking so much that I ported a version of it to Go[1] as a sort of lint. [1]: https://github.com/BurntSushi/go-sumtype
comment by burntsushi · 2023-03-13 · in Switching from C++ to Rust -
Not that it's a great solution, but there's https://github.com/BurntSushi/go-sumtype for (2).
comment by cube2222 · 2022-05-14 · in Safer Enums in Go -
Such a thing exists: https://github.com/BurntSushi/go-sumtype
comment by wlamartin · 2022-03-14 · in Hacking sum types with Go generics -
Or even better, proper sum types. They're a superset of enums anyway. https://github.com/BurntSushi/go-sumtype is great, but a bit unwieldy. Language support would be much better.
comment by lucian1900 · 2022-02-04 · in What I'd like to see in Go 2.0 -
(this is the one I meant: https://github.com/BurntSushi/go-sumtype )
comment by zemo · 2021-12-16 · in Go Replaces Interface{} with 'Any' -
…types: slices, maps, channels, etc. You can't produce a custom type that is to be iterated over. 1. https://github.com/BurntSushi/go-sumtype
comment by lucian1900 · 2021-12-15 · in Go 1.18 Beta 1 is available, with generics -
go-sumtype[0] has completeness checking for sealed interfaces. [0] https://github.com/BurntSushi/go-sumtype
comment by tjalfi · 2021-12-10 · in Notes on the Go translation of Reposurgeon (2020) -
go-sumtype[0] has completeness checking for sealed interfaces. [0] https://github.com/BurntSushi/go-sumtype
comment by tjalfi · 2021-11-09 · in Upcoming Features in Go 1.18 -
…my comment from that other crusty news aggregator: Alternative 1a is to use Alternative 1 with https://github.com/BurntSushi/go-sumtype /plug go-sumtype requires the interface to be sealed (which you're already doing) and one small…
comment by burntsushi · 2018-01-31 · in Alternatives to sum types in Go -
…mapping. [1] https://github.com/gogo/protobuf/issues/218 [2] https://github.com/gogo/protobuf [3] https://github.com/BurntSushi/go-sumtype [4] https://developers.google.com/protocol-buffers/docs/referenc...
comment by lobster_johnson · 2018-01-16 · in Twirp: A new RPC framework for Go -
You may find this helpful for writing a compiler in Go: https://godoc.org/github.com/BurntSushi/go-sumtype
comment by jerf · 2017-10-03 · in Statically typed functional programming language implementation with Go and LLVM -
…of sum types in Go is so painful, to the point that someone wrote a special library for it [1]. [1] https://github.com/BurntSushi/go-sumtype
comment by atombender · 2017-09-14 · in Std::visit is everything wrong with modern C++ -
…tool, the type switch gets you exhaustiveness checks for hokey package-private sum-types in Go :) https://github.com/BurntSushi/go-sumtype
comment by frou_dh · 2017-06-20 · in Go and Simplicity Debt Redux -
▲ 75
Show HN: A utility for running exhaustiveness checks on “sum types” in Gostory by burntsushi · 2017-03-20 · 38 comments