Documentation
¶
Overview ¶
Package nilable implements the Nilable type.
Index ¶
- func Ap[A, B any](fab warp.Nilable[func(A) B], fa warp.Nilable[A]) warp.Nilable[B]
- func ApFirst[A, B any](fa warp.Nilable[A], fb warp.Nilable[B]) warp.Nilable[A]
- func ApSecond[A, B any](fa warp.Nilable[A], fb warp.Nilable[B]) warp.Nilable[B]
- func Attempt[A any](f warp.IO[A]) warp.Nilable[A]
- func Chain[A, B any](ma warp.Nilable[A], f func(A) warp.Nilable[B]) warp.Nilable[B]
- func FromPredicate[A any](a A, predicate warp.Predicate[A]) warp.Nilable[A]
- func FromResult[A any](ctx context.Context, ma warp.Result[A]) warp.Nilable[A]
- func IsNil[A any](a warp.Nilable[A]) bool
- func IsSome[A any](a warp.Nilable[A]) bool
- func Map[A, B any](fa warp.Nilable[A], f func(A) B) warp.Nilable[B]
- func Nil[A any]() warp.Nilable[A]
- func Some[A any](a A) warp.Nilable[A]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ap ¶
Ap creates a nilable by applying a function contained in the first nilable on the value contained in the second nilable if they both exist.
func ApFirst ¶
ApFirst creates a nilable by combining two nilables, keeping only the result of the first.
func ApSecond ¶
ApSecond creates a nilable by combining two nilables, keeping only the result of the second.
func Attempt ¶
Attempt creates a nilable by running a function which returns a value, recovering with nil if a panic is thrown.
func Chain ¶
Chain creates a nilable which combines two nilables in sequence, using the return value of one nilable to determine the next one.
func FromPredicate ¶
FromPredicate creates a nilable by testing a value against a predicate first.
func FromResult ¶
FromResult creates a nilable from a result, returning nil for errors.
Types ¶
This section is empty.