public static Option <T> OrElse <T>(this Option <T> option, Func <Option <T> > func) { if (func == null) { throw new ArgumentNullException(nameof(func)); } return(option.Intent(out _) is OptionData.Some ? option : func.Invoke()); }
public static bool IsNone <T>(this Option <T> option) { return(option.Intent(out _) is OptionData.None); }
public static Option <T> Xor <T>(this Option <T> option, Option <T> other) { return(option.Intent(out _) is OptionData.Some ? other.Intent(out _) is OptionData.Some ? Option <T> .None() : option : other.Intent(out _) is OptionData.Some ? other : Option <T> .None()); }
public static Option <T> Or <T>(this Option <T> option, Option <T> other) { return(option.Intent(out _) is OptionData.Some ? option : other); }
public static Option <U> And <T, U>(this Option <T> option, Option <U> other) { return(option.Intent(out _) is OptionData.Some ? other : Option <U> .None()); }