From 2596a80dfd24ad48f8de7215e4171b3aa583961d Mon Sep 17 00:00:00 2001 From: Pim Brouwers Date: Wed, 28 Aug 2024 14:53:33 -0400 Subject: [PATCH] see refs in comments for option result and result option --- src/Danom/Option/Option.cs | 44 +++++++++---------- src/Danom/Result/Result.cs | 60 +++++++++++++------------- src/Danom/ResultOption/ResultOption.cs | 20 ++++----- 3 files changed, 61 insertions(+), 63 deletions(-) diff --git a/src/Danom/Option/Option.cs b/src/Danom/Option/Option.cs index a1f3aa7..1c49320 100644 --- a/src/Danom/Option/Option.cs +++ b/src/Danom/Option/Option.cs @@ -20,17 +20,17 @@ private Option(T t) } /// - /// Returns true if Option is Some, false otherwise. + /// Returns true if is Some, false otherwise. /// public bool IsSome { get; } = false; /// - /// Returns true if Option is None, false otherwise. + /// Returns true if is None, false otherwise. /// public bool IsNone => !IsSome; /// - /// If Option is Some evaluate the some delegate, otherwise none. + /// If is Some evaluate the some delegate, otherwise none. /// /// /// @@ -42,7 +42,7 @@ public U Match(Func some, Func none) => none(); /// - /// Evaluates the bind delegate if Option is Some otherwise return None. + /// Evaluates the bind delegate if is Some otherwise return None. /// /// /// @@ -52,7 +52,7 @@ public Option Bind( Match(bind, Option.None); /// - /// Evaluates the map delegate if Option is Some otherwise return None. + /// Evaluates the map delegate if is Some otherwise return None. /// /// /// @@ -62,7 +62,7 @@ public Option Map( Bind(x => Option.Some(map(x))); /// - /// Returns the value of Option if it is T otherwise return default. + /// Returns the value of if it is T otherwise return default. /// /// /// @@ -71,7 +71,7 @@ public T DefaultValue( Match(some => some, () => defaultValue); /// - /// Returns the value of Option if it is T otherwise evaluate default. + /// Returns the value of if it is T otherwise evaluate default. /// /// /// @@ -80,7 +80,7 @@ public T DefaultWith( Match(some => some, () => defaultWith()); /// - /// Return Option if it is Some, otherwise return ifNone. + /// Return if it is Some, otherwise return ifNone. /// /// /// @@ -89,7 +89,7 @@ public Option OrElse( Match(Option.Some, () => ifNone); /// - /// Return Option if it is Some, otherwise evaluate ifNoneWith. + /// Return if it is Some, otherwise evaluate ifNoneWith. /// /// /// @@ -99,7 +99,7 @@ public Option OrElseWith( /// - /// Creates a new Option with the specified value. + /// Creates a new with the specified value. /// /// /// @@ -107,7 +107,7 @@ public static Option Some(T value) => new(value); /// - /// Creates Option with the specified value wrapped in a completed Task. + /// Creates with the specified value wrapped in a completed Task. /// /// /// @@ -115,7 +115,7 @@ public static Task> SomeAsync(T value) => Task.FromResult(Some(value)); /// - /// Creates a new Option with the value of the awaited Task. + /// Creates a new with the value of the awaited Task. /// /// /// @@ -123,21 +123,21 @@ public static async Task> SomeAsync(Task value) => Some(await value); /// - /// Creates a new Option with no value. + /// Creates a new with no value. /// /// public static Option None() => new(); /// - /// Creates a new Option with no value wrapped in a completed Task. + /// Creates a new with no value wrapped in a completed Task. /// /// public static Task> NoneAsync() => Task.FromResult(None()); /// - /// Returns true if the specified Options are equal. + /// Returns true if the specified s are equal. /// /// /// @@ -146,7 +146,7 @@ public static Task> NoneAsync() => left.Equals(right); /// - /// Returns true if the specified Options are not equal. + /// Returns true if the specified s are not equal. /// /// /// @@ -155,7 +155,7 @@ public static Task> NoneAsync() => !(left == right); /// - /// Returns true if the specified Options are equal. + /// Returns true if the specified s are equal. /// /// /// @@ -163,7 +163,7 @@ public override bool Equals(object? obj) => obj is Option o && Equals(o); /// - /// Returns true if the specified Options are equal. + /// Returns true if the specified s are equal. /// /// /// @@ -180,7 +180,7 @@ public readonly bool Equals(Option other) => ); /// - /// Returns the hash code of the Option. + /// Returns the hash code of the . /// /// public override int GetHashCode() => @@ -189,7 +189,7 @@ public override int GetHashCode() => none: () => 0); /// - /// Returns the string representation of the Option. + /// Returns the string representation of the . /// /// public override string ToString() => @@ -199,12 +199,12 @@ public override string ToString() => } /// -/// Extension methods to allow Option matching using +/// Extension methods to allow matching using /// public static class OptionActionExtensions { /// - /// If Option is Some, evaluates the some delegate, otherwise evaluates + /// If is Some, evaluates the some delegate, otherwise evaluates /// the none delegate. /// /// diff --git a/src/Danom/Result/Result.cs b/src/Danom/Result/Result.cs index bb61a96..55ef6a2 100644 --- a/src/Danom/Result/Result.cs +++ b/src/Danom/Result/Result.cs @@ -24,17 +24,17 @@ private Result(TError tError) } /// - /// Returns true if Result is Ok, false otherwise. + /// Returns true if is Ok, false otherwise. /// public bool IsOk { get; } = false; /// - /// Returns true if Result is Error, false otherwise. + /// Returns true if is Error, false otherwise. /// public bool IsError => !IsOk; /// - /// If Result is Ok evaluate the ok delegate, otherwise error. + /// If is Ok evaluate the ok delegate, otherwise error. /// /// /// @@ -48,7 +48,7 @@ public U Match(Func ok, Func error) => throw new InvalidOperationException("Result error has not been initialized."); /// - /// Evaluates the bind delegate if Result is Ok otherwise return Error. + /// Evaluates the bind delegate if is Ok otherwise return Error. /// /// /// @@ -58,7 +58,7 @@ public Result Bind( Match(bind, Result.Error); /// - /// Evaluates the map delegate if Result is Ok otherwise return Error. + /// Evaluates the map delegate if is Ok otherwise return Error. /// /// /// @@ -68,7 +68,7 @@ public Result Map( Bind(x => Result.Ok(map(x))); /// - /// Evaluates the mapError delegate if Result is Error otherwise return Ok. + /// Evaluates the mapError delegate if is Error otherwise return Ok. /// /// /// @@ -78,7 +78,7 @@ public Result MapError( Match(Result.Ok, e => Result.Error(mapError(e))); /// - /// Returns the value of Result if it is T, otherwise returns the + /// Returns the value of if it is T, otherwise returns the /// specified default value. /// /// @@ -88,7 +88,7 @@ public T DefaultValue( Match(ok => ok, _ => defaultValue); /// - /// Returns the value of Result if it is T, otherwise returns the + /// Returns the value of if it is T, otherwise returns the /// /// /// @@ -97,7 +97,7 @@ public T DefaultWith( Match(ok => ok, _ => defaultWith()); /// - /// Creates a new Result with the specified value. + /// Creates a new with the specified value. /// /// /// @@ -105,7 +105,7 @@ public static Result Ok(T value) => new(value); /// - /// Creates Result with the specified value wrapped in a completed Task. + /// Creates with the specified value wrapped in a completed Task. /// /// /// @@ -113,7 +113,7 @@ public static Task> OkAsync(T value) => Task.FromResult(Ok(value)); /// - /// Creates Result with the value of the awaited Task. + /// Creates with the value of the awaited Task. /// /// /// @@ -121,7 +121,7 @@ public static async Task> OkAsync(Task valueTask) => Ok(await valueTask); /// - /// Creates a new Result with the specified error. + /// Creates a new with the specified error. /// /// /// @@ -129,7 +129,7 @@ public static Result Error(TError errors) => new(errors); /// - /// Creates Result with the specified error wrapped in a completed Task. + /// Creates with the specified error wrapped in a completed Task. /// /// /// @@ -137,7 +137,7 @@ public static Task> ErrorAsync(TError errors) => Task.FromResult(Error(errors)); /// - /// Creates Result with the value of the awaited Task. + /// Creates with the value of the awaited Task. /// /// /// @@ -145,7 +145,7 @@ public static async Task> ErrorAsync(Task errors) => Error(await errors); /// - /// Returns true if the specified Result is equal to the current Result. + /// Returns true if the specified Result is equal to the current . /// /// /// @@ -154,7 +154,7 @@ public static async Task> ErrorAsync(Task errors) => left.Equals(right); /// - /// Returns true if the specified Result is not equal to the current Result. + /// Returns true if the specified Result is not equal to the current . /// /// /// @@ -163,7 +163,7 @@ public static async Task> ErrorAsync(Task errors) => !(left == right); /// - /// Returns true if the specified Result is equal to the current Result. + /// Returns true if the specified Result is equal to the current . /// /// /// @@ -171,7 +171,7 @@ public override bool Equals(object? obj) => obj is Result o && Equals(o); /// - /// Returns true if the specified Result is equal to the current Result. + /// Returns true if the specified Result is equal to the current . /// /// /// @@ -187,7 +187,7 @@ public readonly bool Equals(Result other) => error: e2 => e2 is not null && e2.Equals(e1))); /// - /// Returns the hash code for the Result. + /// Returns the hash code for the . /// /// public override int GetHashCode() => @@ -196,7 +196,7 @@ public override int GetHashCode() => error: e => e is null ? 0 : e.GetHashCode()); /// - /// Returns a string representation of the Result. + /// Returns a string representation of the . /// /// public override string ToString() => @@ -207,16 +207,14 @@ public override string ToString() => /// -/// The with +/// The with /// as the predefined error type. -/// -/// Alias for . /// /// public static class Result { /// - /// Creates a new Result with the specified value. + /// Creates a new with the specified value. /// /// /// @@ -224,7 +222,7 @@ public static Result Ok(T value) => Result.Ok(value); /// - /// Creates Result with the specified value wrapped in a completed Task. + /// Creates with the specified value wrapped in a completed Task. /// /// /// @@ -232,7 +230,7 @@ public static Task> OkAsync(T value) => Result.OkAsync(value); /// - /// Creates Result with the value of the awaited Task. + /// Creates with the value of the awaited Task. /// /// /// @@ -240,7 +238,7 @@ public static Task> OkAsync(Task valueTask) => Result.OkAsync(valueTask); /// - /// Creates a new Result with the specified error. + /// Creates a new with the specified error. /// /// /// @@ -248,7 +246,7 @@ public static Result Error(ResultErrors errors) => Result.Error(errors); /// - /// Creates Result with the specified error wrapped in a completed Task. + /// Creates with the specified error wrapped in a completed Task. /// /// /// @@ -256,7 +254,7 @@ public static Task> ErrorAsync(ResultErrors errors) => Task.FromResult(Error(errors)); /// - /// Creates a new Result with the specified error. + /// Creates a new with the specified error. /// /// /// @@ -264,7 +262,7 @@ public static Result Error(IEnumerable messages) => Error(new ResultErrors(messages)); /// - /// Creates Result with the specified error wrapped in a completed Task. + /// Creates with the specified error wrapped in a completed Task. /// /// /// @@ -272,7 +270,7 @@ public static Result Error(string message) => Error([message]); /// - /// Creates Result with the specified error wrapped in a completed Task. + /// Creates with the specified error wrapped in a completed Task. /// /// /// diff --git a/src/Danom/ResultOption/ResultOption.cs b/src/Danom/ResultOption/ResultOption.cs index 7cecbbc..0ba3468 100644 --- a/src/Danom/ResultOption/ResultOption.cs +++ b/src/Danom/ResultOption/ResultOption.cs @@ -237,14 +237,14 @@ public override string ToString() => /// -/// Static methods for creating instances with +/// Static methods for creating instances with /// as the error type. /// /// public static class ResultOption { /// - /// Creates a new instance with the + /// Creates a new instance with the /// specified value. /// /// @@ -253,7 +253,7 @@ public static ResultOption Ok(T value) => ResultOption.Ok(value); /// - /// Creates a new instance with the + /// Creates a new instance with the /// value of the awaited Task. /// /// @@ -262,7 +262,7 @@ public static Task> OkAsync(T value) => ResultOption.OkAsync(value); /// - /// Creates a new instance with the + /// Creates a new instance with the /// value of the awaited Task. /// /// @@ -271,7 +271,7 @@ public static Task> OkAsync(Task valueTask) => ResultOption.OkAsync(valueTask); /// - /// Creates a new instance with no + /// Creates a new instance with no /// value. /// /// @@ -279,7 +279,7 @@ public static ResultOption None() => ResultOption.None(); /// - /// Creates a new instance with no + /// Creates a new instance with no /// value wrapped in a completed Task. /// in a completed Task. /// @@ -288,7 +288,7 @@ public static Task> NoneAsync() => ResultOption.NoneAsync(); /// - /// Creates a new instance with the + /// Creates a new instance with the /// specified error. /// /// @@ -297,7 +297,7 @@ public static ResultOption Error(ResultErrors errors) => ResultOption.Error(errors); /// - /// Creates a new instance with the + /// Creates a new instance with the /// specified error. /// /// @@ -306,7 +306,7 @@ public static ResultOption Error(string message) => Error([new ResultError(string.Empty, [message])]); /// - /// Creates a new instance with the + /// Creates a new instance with the /// specified error wrapped in a completed Task. /// /// @@ -315,7 +315,7 @@ public static Task> ErrorAsync(ResultErrors errors Task.FromResult(Error(errors)); /// - /// Creates a new instance with the + /// Creates a new instance with the /// specified error wrapped in a completed Task. /// ///