I have the following code
let rec consume() : Async<unit> = async { ..... listA |> Seq.iter(fun i -> ..... let listB : seq<...> option = let c = getListB a b match c with | Some d -> Seq.filter(....) |> Some | None -> None
Now the function getListB
is converted to retu async<Seq<B>>
instead of Seq<B>
. So the code was converted to the following. However, the getListB
blocked the execution. How to rewrite it nonblocking? Simply convert the line to let! c = getListB a b
won't work because the code is in an inner lambda.
let rec consume() : Async<unit> = async { ..... listA |> Seq.iter(fun i -> ..... let listB : seq<...> option = let c = getListB a b |> Async.RunSynchronously match c with | Some d -> Seq.filter(....) |> Some | None -> None