Replies: 2 comments 5 replies
-
|
It's already possible today to use the type AsyncBuilder with
member this.MergeSources(m1: Async<'t1>, m2: Async<'t2>) : Async<'t1 * 't2> = async {
let! m1' = Async.StartChild m1
let! m2' = Async.StartChild m2
let! m1'' = m1'
let! m2'' = m2'
return m1'', m2''
}
let workA () = async {
printfn "[A] Starting"
for i in 0..10 do
printfn "[A] i = %d" i
do! Async.Sleep 100
printfn "[A] done"
return 42
}
let workB () = async {
printfn "[B] Starting"
for i in 0..10 do
printfn "[B] i = %d" i
do! Async.Sleep 75
printfn "[B] done"
return "supercalifragilisticexpialidocious"
}
let f () = async {
let! a = workA ()
and! b = workB ()
printfn "A result: %d" a
printfn "B result: %s" b
} |
Beta Was this translation helpful? Give feedback.
5 replies
-
|
Impl (in both cases) an be simplified to: (which is what Async.Parallel kinda does) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
nowadays noise increases with the amount of works I start as child, since I have to add
let! x = aXfor all of themwould be better if I could just
although

and!is already taken, maybe we can add another keyword(if I do I get this :
)
Beta Was this translation helpful? Give feedback.
All reactions