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

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

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

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