@@ -31,6 +31,43 @@ module Async =
31
31
let! c = z
32
32
return f a b c}
33
33
34
+ /// <summary>Creates an async workflow from two workflows 'x' and 'y', mapping its results with 'f'.</summary>
35
+ /// <remarks>Similar to map2 but workflows are run in parallel.</remarks>
36
+ /// <param name="f">The mapping function.</param>
37
+ /// <param name="x">First async workflow.</param>
38
+ /// <param name="y">Second async workflow.</param>
39
+ #if FABLE_ COMPILER
40
+ let pmap2 f x y = map2 f x y
41
+ #else
42
+ let pmap2 f x y = async {
43
+ let! ct = Async.CancellationToken
44
+ let x = Async.StartImmediateAsTask ( x, ct)
45
+ let y = Async.StartImmediateAsTask ( y, ct)
46
+ let! x ' = Async.AwaitTask x
47
+ let! y ' = Async.AwaitTask y
48
+ return f x' y' }
49
+ #endif
50
+
51
+ /// <summary>Creates an async workflow from three workflows 'x', 'y' and 'z', mapping its results with 'f'.</summary>
52
+ /// <remarks>Similar to map3 but workflows are run in parallel.</remarks>
53
+ /// <param name="f">The mapping function.</param>
54
+ /// <param name="x">First async workflow.</param>
55
+ /// <param name="y">Second async workflow.</param>
56
+ /// <param name="z">third async workflow.</param>
57
+ #if FABLE_ COMPILER
58
+ let pmap3 f x y z = map3 f x y z
59
+ #else
60
+ let pmap3 f x y z = async {
61
+ let! ct = Async.CancellationToken
62
+ let x = Async.StartImmediateAsTask ( x, ct)
63
+ let y = Async.StartImmediateAsTask ( y, ct)
64
+ let z = Async.StartImmediateAsTask ( z, ct)
65
+ let! x ' = Async.AwaitTask x
66
+ let! y ' = Async.AwaitTask y
67
+ let! z ' = Async.AwaitTask z
68
+ return f x' y' z' }
69
+ #endif
70
+
34
71
/// <summary>Creates an async workflow from two workflows 'x' and 'y', tupling its results.</summary>
35
72
let zip x y = async {
36
73
let! a = x
0 commit comments