Documentation
¶
Overview ¶
Package matchopt provides helpers for building Option-based pattern-match arms.
Index ¶
- func Alt[A any](cases []O.Option[A]) O.Option[A]
- func Case[A, B any](pred func(A) bool, f func(A) B) func(A) O.Option[B]
- func Const[A, B any](pred func(A) bool, value B) func(A) O.Option[B]
- func Default[A, B any](f func(A) B) func(A) O.Option[B]
- func First[A any](fallback A, cases []O.Option[A]) A
- func Match[A, B any](fallback B, cases []O.Kleisli[A, B]) func(A) B
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Match ¶
Match lazily dispatches input to the first matching case in order, returning fallback when no case matches. Unlike First, which folds already-applied options, Match applies cases itself and stops invoking them at the first Some: later cases never run, so guard cost is not paid past the match.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.