Example #1
0
        public override bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched)
        {
            value   = default;
            matched = noMatch <TMatched>();

            return(false);
        }
Example #2
0
        public override bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched)
        {
            value   = default;
            matched = failedMatch <TMatched>(exception);

            return(false);
        }
Example #3
0
        public override bool ValueOrOriginal(out T value, out Matched <T> original)
        {
            value    = default;
            original = this;

            return(false);
        }
Example #4
0
 public override Matched <TResult> Select <TResult>(Matched <T> result, Func <T, TResult> func)
 {
     return(failedMatch <TResult>(exception));
 }
Example #5
0
 public override Matched <TResult> Select <TResult>(Matched <T> result, Func <T, TResult> func) => noMatch <TResult>();
Example #6
0
 public override bool EqualToValueOf(Matched <T> otherMatched) => false;
Example #7
0
 public override Matched <T> Or(Matched <T> other) => other;
Example #8
0
 public override bool Else <TOther>(out Matched <TOther> result)
 {
     result = failedMatch <TOther>(exception);
     return(true);
 }
Example #9
0
 void handle(Matched <T> match)
 {
     if (match.If(out var value, out var exception) && matched.If(out var action))
     {
         action(value);
     }
Example #10
0
 public override bool Else <TOther>(out Matched <TOther> result)
 {
     result = noMatch <TOther>();
     return(true);
 }
Example #11
0
 public abstract Matched <TResult> Select <TResult>(Matched <T> result, Func <T, TResult> func);
Example #12
0
 public MatchingContext(Matched <T> matched) => this.matched = matched;
Example #13
0
 public Matching(Matched <T> matched)
 {
     this.matched = matched;
     action       = MonadFunctions.none <Func <TResult> >();
 }
Example #14
0
 public abstract bool EqualToValueOf(Matched <T> otherMatched);
Example #15
0
 public abstract bool WasMatched(out Matched <T> matched);
Example #16
0
 public abstract bool Else <TOther>(out Matched <TOther> result);
Example #17
0
 public abstract bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched);
Example #18
0
 public abstract bool ValueOrOriginal(out T value, out Matched <T> original);
Example #19
0
 public override bool WasMatched(out Matched <T> matched)
 {
     matched = this;
     return(false);
 }
Example #20
0
 public abstract Matched <T> Or(Matched <T> other);