Example #1
0
 public static FSharpChoice <Unit, Unit, Unit> LTGTEQ(int n)
 {
     if (n < 0)
     {
         return(FSharpChoice <Unit, Unit, Unit> .NewChoice1Of3((Unit)null));
     }
     if (n > 0)
     {
         return(FSharpChoice <Unit, Unit, Unit> .NewChoice2Of3((Unit)null));
     }
     return(FSharpChoice <Unit, Unit, Unit> .NewChoice3Of3((Unit)null));
 }
Example #2
0
        public static FSharpChoice <TR1, TR2, TR3> Transform <T1, T2, T3, TR1, TR2, TR3>(this FSharpChoice <T1, T2, T3> choice, Func <T1, TR1> func1, Func <T2, TR2> func2, Func <T3, TR3> func3)
        {
            switch (choice.Tag)
            {
            case FSharpChoice <T1, T2, T3> .Tags.Choice1Of3:
                return(FSharpChoice <TR1, TR2, TR3> .NewChoice1Of3(func1((choice.CastTo <FSharpChoice <T1, T2, T3> .Choice1Of3>()).Item)));

            case FSharpChoice <T1, T2, T3> .Tags.Choice2Of3:
                return(FSharpChoice <TR1, TR2, TR3> .NewChoice2Of3(func2((choice.CastTo <FSharpChoice <T1, T2, T3> .Choice2Of3>()).Item)));

            case FSharpChoice <T1, T2, T3> .Tags.Choice3Of3:
                return(FSharpChoice <TR1, TR2, TR3> .NewChoice3Of3(func3((choice.CastTo <FSharpChoice <T1, T2, T3> .Choice3Of3>()).Item)));
            }
            throw new InvalidOperationException();
        }