collection

package
v0.0.0-...-0e61b49 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func For

func For[A any](xs Iterable[A], f func(A))

func ForEach

func ForEach[A any](xs Iterable[A], f func(int, A))

func Iterate

func Iterate[A any](iter Iterator[A], f func(A))

func Range

func Range[A any](xs Iterable[A]) <-chan A

for x := range Range(customContainer) {}

Types

type Collector

type Collector[F_, A any] interface {
	Collect(Iterator[A]) types.HKT[F_, A]
}

F[A] should be a FromIterator[A]

type FromIterator

type FromIterator[F_, A any] interface {
	FromIter(Iterator[A]) types.HKT[F_, A]
}

type IterFunctor

type IterFunctor[F_, A, B any] struct {
	impl.Implement[types.HKT[F_, A], Iterable[A]] //Well, we need summoner!
	FromIterator[F_, B]
}

func (*IterFunctor[F_, A, B]) Fmap

func (functor *IterFunctor[F_, A, B]) Fmap(
	xs types.HKT[F_, A],
	f func(A) B,
) types.HKT[F_, B]

type IterMap

type IterMap[A, B any] struct {
	// contains filtered or unexported fields
}

func (*IterMap[A, B]) Next

func (iter *IterMap[A, B]) Next() maybe.Maybe[B]

type Iterable

type Iterable[A any] interface {
	Iter() Iterator[A]
}

func FromIter

func FromIter[A any](iter Iterator[A]) Iterable[A]

type Iterator

type Iterator[A any] interface {
	Next() maybe.Maybe[A] //Stateful interface!
}

func EmptyIter

func EmptyIter[A any]() Iterator[A]

func Zip

func Zip[A, B any](xs Iterator[A], ys Iterator[B]) Iterator[tuple.Tuple2[A, B]]

func ZipBy

func ZipBy[A, B, C any](xs Iterator[A], ys Iterator[B], f func(A, B) C) Iterator[C]

type IteratorIsIterable

type IteratorIsIterable[A any] struct {
	// contains filtered or unexported fields
}

func (*IteratorIsIterable[A]) Iter

func (iter *IteratorIsIterable[A]) Iter() Iterator[A]

Jump to

Keyboard shortcuts

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