go

module
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MIT

README

Go Source code for UnMango

A collection of random Go packages.

iter

Builds on the standard iter package. Re-exports Seq and Seq2 and adds Seq3. Adds a few sequence creation functions such as Empty and Singleton.

var seq Seq[int] = iter.Empty[int]()
var seq Seq[int] = iter.Singleton[int]()

maps

Currently only adds Collect for creating a map[] from a Seq2.

func Test(seq iter.Seq2[string, int]) {
	var m map[string]int = maps.Collect(seq)
}

result

Adds the Result type representing either success or error. Adds various result operations such as Map and Bind.

func main() {
	var r Result[int] = func() (int, error) {
		return 420, nil
	}

	r = result.Map(r, func(x int) int {
		return x+1
	})
}

seqs

Adds various sequence operations such as Map.

func Test(seq iter.Seq[int]) {
	seqs.Map(seq, func(x int) int {
		return x+1
	})
}

slices

Currently only re-exports Collect.

Inspiration

I stand on the shoulders of giants. A lot of this is inspired by the works of others, be sure to check out these repos as well. (They're much smarter than me)

https://github.com/fogfish/golem

https://github.com/IBM/fp-go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL