Extension methods for the haxe.ds.Option type.
Static methods
staticinlinealt2<A>(a:Option<A>, b:Option<A>):Option<A>
Returns the first Some value, or None
Alias for orElse, but intended for static use, and leads into alt3, alt4, alts, etc.
staticinlinealt3<A>(a:Option<A>, b:Option<A>, c:Option<A>):Option<A>
Returns the first Some value, or None
staticinlinealt4<A>(a:Option<A>, b:Option<A>, c:Option<A>, d:Option<A>):Option<A>
Returns the first Some value, or None
staticaltsF<A>(fs:ReadonlyArray<() ‑> Option<A>>):Option<A>
Returns the result of the first function that produces a Some value, or None
staticinlineap4<A, B, C, D, E>(f:(A, B, C, D) ‑> E, v1:Option<A>, v2:Option<B>, v3:Option<C>, v4:Option<D>):Option<E>
staticinlineap5<A, B, C, D, E, F>(f:(A, B, C, D, E) ‑> F, v1:Option<A>, v2:Option<B>, v3:Option<C>, v4:Option<D>, v5:Option<E>):Option<F>
staticinlineap6<A, B, C, D, E, F, G>(f:(A, B, C, D, E, F) ‑> G, v1:Option<A>, v2:Option<B>, v3:Option<C>, v4:Option<D>, v5:Option<E>, v6:Option<F>):Option<G>
staticinlineap7<A, B, C, D, E, F, G, H>(f:(A, B, C, D, E, F, G) ‑> H, v1:Option<A>, v2:Option<B>, v3:Option<C>, v4:Option<D>, v5:Option<E>, v6:Option<F>, v7:Option<G>):Option<H>
staticinlineap8<A, B, C, D, E, F, G, H, I>(f:(A, B, C, D, E, F, G, H) ‑> I, v1:Option<A>, v2:Option<B>, v3:Option<C>, v4:Option<D>, v5:Option<E>, v6:Option<F>, v7:Option<G>, v8:Option<H>):Option<I>
staticcata<A, B>(option:Option<A>, ifNone:B, f:A ‑> B):B
cata the option catamorphism, useful for inline deconstruction.
staticinlinecombine4<A, B, C, D>(a:Option<A>, b:Option<B>, c:Option<C>, d:Option<D>):Option<Tuple4<A, B, C, D>>
staticinlinecombine5<A, B, C, D, E>(a:Option<A>, b:Option<B>, c:Option<C>, d:Option<D>, e:Option<E>):Option<Tuple5<A, B, C, D, E>>
staticinlinecombine6<A, B, C, D, E, F>(a:Option<A>, b:Option<B>, c:Option<C>, d:Option<D>, e:Option<E>, f:Option<F>):Option<Tuple6<A, B, C, D, E, F>>
staticequals<T>(a:Option<T>, b:Option<T>, ?eq:(T, T) ‑> Bool):Bool
Equality function to campare two Option values of the same type. An optional equality
function can be provided if values inside Some should be compared using something
different than strict equality.
staticequalsValue<T>(a:Option<T>, b:Null<T>, ?eq:(T, T) ‑> Bool):Bool
equalsValue compares an Option<T> with a value T. The logic adopted to compare
values is the same as in Options.equals().
staticfilter<A>(option:Option<A>, f:A ‑> Bool):Option<A>
filter returns the current value if any contained value matches the predicate, None otherwise.
staticflatMap<T, TOut>(option:Option<T>, callback:T ‑> Option<TOut>):Option<TOut>
flatMap is shortcut for map(cb).join()
staticfoldLeft<T, B>(option:Option<T>, b:B, f:(B, T) ‑> B):B
foldLeft reduce using an accumulating function and an initial value.
staticfoldLeftf<T, B>(option:Option<T>, b:() ‑> B, f:(B, T) ‑> B):B
Lazy version of thx.Options.foldLeft
staticfoldMap<A, B>(option:Option<A>, f:A ‑> B, m:Monoid<B>):B
Fold by mapping the contained value into some monoidal type and reducing with that monoid.
staticgetOrElseF<T>(option:Option<T>, alt:() ‑> T):T
staticgetOrFail<T>(option:Option<T>, msg:String, ?posInfo:PosInfos):T
Extract the value from Option or throw a thx.Error with the provided message.
staticgetOrThrow<T>(option:Option<T>, ?err:Error, ?posInfo:PosInfos):T
staticjoin<T>(option:Option<Option<T>>):Option<T>
join collapses a nested option into a single optional value.
staticorElse<T>(option:Option<T>, alt:Option<T>):Option<T>
orElse returns option if it holds a value or alt otherwise.
staticorElseF<T>(option:Option<T>, alt:() ‑> Option<T>):Option<T>
orElseF returns option if it holds a value or calls alt to produce a default Option<T>.
staticinlinespread5<A, B, C, D, E, F>(v:Option<Tuple5<A, B, C, D, E>>, f:(A, B, C, D, E) ‑> F):Option<F>
staticinlinespread6<A, B, C, D, E, F, G>(v:Option<Tuple6<A, B, C, D, E, F>>, f:(A, B, C, D, E, F) ‑> G):Option<G>
staticinlinetoOption<T>(value:Null<T>):Option<T>
toOption transforms any type T into Option<T>. If the value is null, the result
is be None.
statictraverseValidation<E, T, U>(option:Option<T>, f:T ‑> Validation<E, U>):Validation<E, Option<U>>
Traverse the array with a function that may return values wrapped in Validation. If any of the values are Failures, return a Failure that accumulates all errors from the failed values, otherwise return the array of mapped values in a Success.