Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoneGet = errors.New("none.Get")
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option[T any] interface { IsDefined() bool IsEmpty() bool Get() (T, error) OrElse(other T) T OrDefault() T ToSlice() []T Filter(p funcs.Predicate[T]) Option[T] Foreach(p funcs.Procedure[T]) Option[T] // Map method can't change the category; see Map function for that matter. Map(mapper funcs.Mapper[T, T]) Option[T] // FlatMap method can't change the category; see FlatMap function for that matter. FlatMap(mapper FMapper[T, T]) Option[T] }
Option represents the simplest monad that can contain some value, available for mapping with Map,
or nothing (none).
With that said, Map mapper will never face nil.
Click to show internal directories.
Click to hide internal directories.