lang

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Zero

func Zero[T any]() T

Zero is a zero value for the given type.

Types

type Either

type Either[L, R any] interface {
	// IsLeft returns true if the Either instance is a Left.
	IsLeft() bool
	// Left returns the left value.
	Left() L
	// IsRight returns true if the Either instance is a Right.
	IsRight() bool
	// Right returns the right value.
	Right() R
}

Either is an interface that represents a value of one of two possible types.

type Option

type Option[T any] interface {
	// IsDefined returns true if the Option instance is defined.
	IsDefined() bool
	// IsEmpty returns true if the Option instance is empty.
	IsEmpty() bool
	// Get returns the value of the Option instance.
	Get() T
	// GetOrElse returns the value of the Option instance if it is defined. Otherwise, it returns the given default value.
	GetOrElse(defaultValue T) T
}

Option is a type that represents an optional value.

type Tuple2

type Tuple2[A any, B any] interface {
	// A returns the first element of the tuple.
	A() A
	// B returns the second element of the tuple.
	B() B
}

Tuple2 is a tuple of two elements.

type Tuple3

type Tuple3[A any, B any, C any] interface {
	// A returns the first element of the tuple.
	A() A
	// B returns the second element of the tuple.
	B() B
	// C returns the third element of the tuple.
	C() C
}

Tuple3 is a tuple of three elements.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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