Go streams (a look at what is possible with generics)

This page summarizes the projects mentioned and recommended in the original post on /r/golang

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • genesis

    All generic functions for Go you ever need! (by life4)

    I faced the same issue when migrating genesis from code generation to generics. Before it used to have the same streaming API as you describe but now I decided to go with functional API. That means, you basically "pipe" data with temporary variables. So your last example would look something like this:

  • CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  • go

    The Go programming language

    Yes, it requires you to come up with more variable names but it doesn't make code much longer or less readable. The proposal add elixir-like pipe operator has a long discussion on the subject. That said, I'm still trying to figure out if it is possible to implement with generics some kind of pipe or lenses.

  • iter

    Experimental lazy iterator library to test the capabilities of go generics in 1.18 (by urandom)

    Came to pretty similar conclusions regarding the ergonomics myself: https://github.com/urandom/iter/blob/main/README.md

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • FYI: pkg.go.dev doesn't show packages with generics

    2 projects | /r/golang | 29 Dec 2021
  • [go1.18beata1] Bug while runnings package tests on generic code

    3 projects | /r/golang | 25 Dec 2021
  • Go Generics Facilitators

    6 projects | news.ycombinator.com | 22 Dec 2021
  • Go proposal: finite type set interface as union type

    1 project | news.ycombinator.com | 10 Dec 2024
  • Good union types in Go would probably need types without a zero value

    3 projects | news.ycombinator.com | 8 Dec 2024

Did you konow that Go is
the 4th most popular programming language
based on number of metions?