Skip to content

Commit

Permalink
Merge pull request #726 from polyadic/import-static-debugger-browsabl…
Browse files Browse the repository at this point in the history
…e-state
  • Loading branch information
bash authored Apr 26, 2023
2 parents d3c18d9 + 5131390 commit b533d47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Funcky/Monads/Either/Either.Debugger.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Diagnostics;
using static System.Diagnostics.DebuggerBrowsableState;

namespace Funcky.Monads;

[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
[DebuggerTypeProxy(typeof(EitherDebugView<,>))]
public readonly partial struct Either<TLeft, TRight>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[DebuggerBrowsable(Never)]
private string DebuggerDisplay => Match(
uninitialized: static () => "default",
left: static _ => "Left",
Expand All @@ -21,7 +22,7 @@ internal sealed class EitherDebugView<TLeft, TRight>

public EitherDebugView(Either<TLeft, TRight> either) => _either = either;

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
[DebuggerBrowsable(RootHidden)]
public object Value => _either.Match<object>(
uninitialized: static () => new { },
left: left => new { Value = left },
Expand Down
5 changes: 3 additions & 2 deletions Funcky/Monads/Option/Option.Debugger.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Diagnostics;
using static System.Diagnostics.DebuggerBrowsableState;

namespace Funcky.Monads;

[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
[DebuggerTypeProxy(typeof(OptionDebugView<>))]
public readonly partial struct Option<TItem>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[DebuggerBrowsable(Never)]
private string DebuggerDisplay => Match(
none: "None",
some: _ => "Some");
Expand All @@ -19,7 +20,7 @@ internal sealed class OptionDebugView<T>

public OptionDebugView(Option<T> option) => _option = option;

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
[DebuggerBrowsable(RootHidden)]
public object Value => _option.Match(
none: () => (object)new { },
some: value => new { Value = value });
Expand Down
5 changes: 3 additions & 2 deletions Funcky/Monads/Result/Result.Debugger.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Diagnostics;
using static System.Diagnostics.DebuggerBrowsableState;

namespace Funcky.Monads;

[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
[DebuggerTypeProxy(typeof(ResultDebugView<>))]
public readonly partial struct Result<TValidResult>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[DebuggerBrowsable(Never)]
private string DebuggerDisplay => Match(
ok: _ => "Ok",
error: _ => "Error");
Expand All @@ -19,7 +20,7 @@ internal sealed class ResultDebugView<TValidResult>

public ResultDebugView(Result<TValidResult> option) => _option = option;

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
[DebuggerBrowsable(RootHidden)]
public object Value => _option.Match(
ok: value => (object)new { Value = value },
error: exception => new { Exception = exception });
Expand Down

0 comments on commit b533d47

Please sign in to comment.