Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
inputfalken committed Oct 6, 2018
1 parent 07e250b commit 2cf4a8a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Lemonad.ErrorHandling/Validator.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Lemonad.ErrorHandling.Internal;

namespace Lemonad.ErrorHandling {
/// <summary>
Expand All @@ -19,10 +20,10 @@ namespace Lemonad.ErrorHandling {
/// <summary>
/// Convert to a <see cref="Result{T,TError}"/>.
/// </summary>
public Result<T, IReadOnlyCollection<TError>> Result {
public IResult<T, IReadOnlyCollection<TError>> Result {
get {
var candidate = _candidate;
return _errors.ToResultError<T, IReadOnlyCollection<TError>>(x => x.Count > 0, () => candidate);
return _errors.ToResultError<T, IReadOnlyCollection<TError>>(x => x.Count > 0, _ => candidate);
}
}

Expand Down Expand Up @@ -58,8 +59,8 @@ private Validator(in Queue<TError> errors, in T candidate) {
/// An <see cref="Validator{T,TError}"/>.
/// </returns>
public Validator<T, TError> Validate(Func<T, bool> predicate, Func<TError> errorSelector) {
var result = _candidate.ToResult(predicate, errorSelector);
if (result.HasError) _errors.Enqueue(result.Error);
var result = _candidate.ToResult(predicate, _ => errorSelector());
if (result.Either.HasError) _errors.Enqueue(result.Either.Error);
return new Validator<T, TError>(_errors, _candidate);
}

Expand Down

0 comments on commit 2cf4a8a

Please sign in to comment.