Help us shape the future of Go! Take the 2026 Go Developer Survey

monad

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error[T any] struct {
	Err error
}

func (Error[T]) AsError added in v0.0.12

func (err Error[T]) AsError(value any) bool

func (Error[T]) AsErrorIn added in v0.0.12

func (err Error[T]) AsErrorIn(values ...any) bool

func (Error[T]) Error

func (err Error[T]) Error(call func(error) Result[T]) Result[T]

func (Error[T]) Is added in v0.0.11

func (err Error[T]) Is(T) bool

func (Error[T]) IsError added in v0.0.11

func (err Error[T]) IsError(value error) bool

func (Error[T]) IsErrorIn added in v0.0.12

func (err Error[T]) IsErrorIn(values ...error) bool

func (Error[T]) IsIn added in v0.0.12

func (err Error[T]) IsIn(...T) bool

func (Error[T]) Or

func (err Error[T]) Or(value T) Result[T]

func (Error[T]) String

func (err Error[T]) String() string

func (Error[T]) Then

func (err Error[T]) Then(func(T) Result[T]) Result[T]

func (Error[T]) TryError

func (err Error[T]) TryError() error

func (Error[T]) TryValue

func (err Error[T]) TryValue() T

func (Error[T]) WhenError

func (err Error[T]) WhenError(call func(error)) Result[T]

func (Error[T]) WhenOK

func (err Error[T]) WhenOK(call func(T)) Result[T]

type Maybe

type Maybe[T any] interface {
	Then(call func(T) Maybe[T]) Maybe[T]
	Else(call func() Maybe[T]) Maybe[T]
	WhenValue(call func(T)) Maybe[T]
	WhenNothing(call func()) Maybe[T]
	Or(value T) Maybe[T]
	Is(value T) bool
	IsIn(value ...T) bool
	TryValue() T
	// contains filtered or unexported methods
}

func NewMaybe

func NewMaybe[T any](value *T) Maybe[T]

type MaybeIsNothingError

type MaybeIsNothingError struct {
	// contains filtered or unexported fields
}

func NewMaybeIsNothingError

func NewMaybeIsNothingError() MaybeIsNothingError

type Nothing

type Nothing[T any] struct{}

func (Nothing[T]) Else

func (nothing Nothing[T]) Else(call func() Maybe[T]) Maybe[T]

func (Nothing[T]) Is added in v0.0.11

func (nothing Nothing[T]) Is(T) bool

func (Nothing[T]) IsIn added in v0.0.12

func (nothing Nothing[T]) IsIn(...T) bool

func (Nothing[T]) Or

func (nothing Nothing[T]) Or(value T) Maybe[T]

func (Nothing[T]) String

func (Nothing[T]) String() string

func (Nothing[T]) Then

func (nothing Nothing[T]) Then(func(T) Maybe[T]) Maybe[T]

func (Nothing[T]) TryValue

func (Nothing[T]) TryValue() T

func (Nothing[T]) WhenNothing

func (nothing Nothing[T]) WhenNothing(call func()) Maybe[T]

func (Nothing[T]) WhenValue

func (nothing Nothing[T]) WhenValue(func(T)) Maybe[T]

type OK

type OK[T any] struct {
	Value T
}

func (OK[T]) AsError added in v0.0.12

func (ok OK[T]) AsError(any) bool

func (OK[T]) AsErrorIn added in v0.0.12

func (ok OK[T]) AsErrorIn(...any) bool

func (OK[T]) Error

func (ok OK[T]) Error(func(error) Result[T]) Result[T]

func (OK[T]) Is added in v0.0.11

func (ok OK[T]) Is(value T) bool

func (OK[T]) IsError added in v0.0.11

func (ok OK[T]) IsError(error) bool

func (OK[T]) IsErrorIn added in v0.0.12

func (ok OK[T]) IsErrorIn(...error) bool

func (OK[T]) IsIn added in v0.0.12

func (ok OK[T]) IsIn(values ...T) bool

func (OK[T]) Or

func (ok OK[T]) Or(T) Result[T]

func (OK[T]) String

func (ok OK[T]) String() string

func (OK[T]) Then

func (ok OK[T]) Then(call func(T) Result[T]) Result[T]

func (OK[T]) TryError

func (ok OK[T]) TryError() error

func (OK[T]) TryValue

func (ok OK[T]) TryValue() T

func (OK[T]) WhenError

func (ok OK[T]) WhenError(func(error)) Result[T]

func (OK[T]) WhenOK

func (ok OK[T]) WhenOK(call func(T)) Result[T]

type Result

type Result[T any] interface {
	Then(call func(T) Result[T]) Result[T]
	Error(call func(error) Result[T]) Result[T]
	WhenOK(call func(T)) Result[T]
	WhenError(call func(error)) Result[T]
	Or(value T) Result[T]
	Is(value T) bool
	IsIn(value ...T) bool
	IsError(value error) bool
	IsErrorIn(value ...error) bool
	AsError(value any) bool
	AsErrorIn(value ...any) bool
	TryValue() T
	TryError() error
	// contains filtered or unexported methods
}

type ResultIsErrorError

type ResultIsErrorError struct {
	Err error
	// contains filtered or unexported fields
}

func NewResultIsErrorError

func NewResultIsErrorError(err error) ResultIsErrorError

type ResultIsOkError

type ResultIsOkError struct {
	// contains filtered or unexported fields
}

func NewResultIsOkError

func NewResultIsOkError() ResultIsOkError

type Some

type Some[T any] struct {
	Value T
}

func (Some[T]) Else

func (some Some[T]) Else(func() Maybe[T]) Maybe[T]

func (Some[T]) Is added in v0.0.11

func (some Some[T]) Is(value T) bool

func (Some[T]) IsIn added in v0.0.12

func (some Some[T]) IsIn(values ...T) bool

func (Some[T]) Or

func (some Some[T]) Or(T) Maybe[T]

func (Some[T]) String

func (some Some[T]) String() string

func (Some[T]) Then

func (some Some[T]) Then(call func(T) Maybe[T]) Maybe[T]

func (Some[T]) TryValue

func (some Some[T]) TryValue() T

func (Some[T]) WhenNothing

func (some Some[T]) WhenNothing(func()) Maybe[T]

func (Some[T]) WhenValue

func (some Some[T]) WhenValue(call func(T)) Maybe[T]

Jump to

Keyboard shortcuts

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