An experimental collection of utility functions (sources, combinators, sinks) for working with Go iterators.
go get github.com/jub0bs/iterutil
jub0bs/iterutil requires Go 1.23 or above.
The documentation is available on pkg.go.dev.
All source code is covered by the MIT License.
- Haskell's prelude
- the slices and maps packages
- golang/go#61898
You can, but at your own peril. At this early stage, I reserve the right, upon new releases, to break the API: some functions may see their names, signatures, and/or behaviors change, and some functions may be removed altogether.
If you need a few functions from this library but do not want to depend on it, feel free to copy their sources in your project; a little copying is better than a little dependency.
Above all, use it with parsimony. Chaining many combinators is far from ideal for several reasons:
- code readability may suffer, in part because Go's idiosyncracies hinder "fluent chaining" and because Go lacks a concise notation for anonymous functions;
- a more classic and imperative style is likely to prove more performant;
- Go lacks the powerful laziness of Haskell.
Bear in mind that the existence of this library is no license to overuse combinator chaining in your codebase!