You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/FSharpPlus/Extensions/Choice.fs
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,19 @@ module Choice =
30
30
/// <returns>The combined value, or the first Choice2Of2.</returns>
31
31
letmap2 f (x:Choice<'T,'Error>)(y:Choice<'U,'Error>):Choice<'V,'Error>=match x, y with Choice1Of2 a, Choice1Of2 b -> Choice1Of2 (f a b)| Choice2Of2 e,_|_, Choice2Of2 e -> Choice2Of2 e
32
32
33
+
/// <summary>Creates a Choice value from three of Choice values, using a function to combine the Choice1Of2 values.</summary>
34
+
/// <param name="x">The first Choice value.</param>
35
+
/// <param name="y">The second Choice value.</param>
36
+
/// <param name="z">The third Choice value.</param>
37
+
///
38
+
/// <returns>The combined value, or the first Choice2Of2.</returns>
39
+
letmap3 f (x:Choice<'T,'Error>)(y:Choice<'U,'Error>)(z:Choice<'V,'Error>):Choice<'W,'Error>=
40
+
match x, y, z with
41
+
| Choice1Of2 a, Choice1Of2 b, Choice1Of2 c -> Choice1Of2 (f a b c)
42
+
| Choice2Of2 e,_,_
43
+
|_, Choice2Of2 e,_
44
+
|_,_, Choice2Of2 e -> Choice2Of2 e
45
+
33
46
/// <summary>Flattens two nested Choice.</summary>
0 commit comments