Skip to content

Commit

Permalink
Fixes #409 IMaybe interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vkhorikov committed Apr 25, 2022
1 parent d136d8d commit f4e6a08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion CSharpFunctionalExtensions/Maybe/Maybe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace CSharpFunctionalExtensions
{
[Serializable]
public struct Maybe<T> : IEquatable<Maybe<T>>
public struct Maybe<T> : IEquatable<Maybe<T>>, IMaybe<T>
{
private readonly bool _isValueSet;

Expand Down Expand Up @@ -155,4 +155,14 @@ public struct Maybe
/// </summary>
public static Maybe<T> From<T>(T value) => Maybe<T>.From(value);
}

/// <summary>
/// Useful in scenarios where you need to determine if a value is Maybe or not
/// </summary>
public interface IMaybe<T>
{
T Value { get; }
bool HasValue { get; }
bool HasNoValue { get; }
}
}
4 changes: 2 additions & 2 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2.29.0
2.29.1
New features:
* #406 UnitResult overloads for Check, CheckIf, Combine and FailureIf
* #409 IMaybe interface

Fixed issues:
* None

0 comments on commit f4e6a08

Please sign in to comment.