Hacker GitHub

← All repos

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

Mentions per year 16 mentions · busiest year 2017 (4)
20082026
  1. …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
  2. …get exhaustiveness checking at compile time, unless you adjoin a linter to your compile process: https://github.com/BurntSushi/go-sumtype
  3. …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
  4. 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
  5. Such a thing exists: https://github.com/BurntSushi/go-sumtype
    comment by wlamartin · 2022-03-14 · in Hacking sum types with Go generics
  6. 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
  7. (this is the one I meant: https://github.com/BurntSushi/go-sumtype )
    comment by zemo · 2021-12-16 · in Go Replaces Interface{} with 'Any'
  8. …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
  9. go-sumtype[0] has completeness checking for sealed interfaces. [0] https://github.com/BurntSushi/go-sumtype
  10. 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
  11. …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
  12. …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
  13. You may find this helpful for writing a compiler in Go: https://godoc.org/github.com/BurntSushi/go-sumtype
  14. …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
  15. …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
  16. ▲ 75
    Show HN: A utility for running exhaustiveness checks on “sum types” in Go
    story by burntsushi · 2017-03-20 · 38 comments