For example:
let test () = async { try do! someting () finally do! sometingElse () }
You can't do do! in that, finally, you get a message from the compiler, "you can use do! in the expression of the calculation", but it is still there right.
I know how I can solve this, but I would like to understand why the compiler restricts this scenario.
Well after some fiddeling, I think it was so discouraged: (I am very happy that we can write cexprs)
from
async { try do! someting () do! sometingElse () finally printfn "finally" }
in
async.TryFinally( async.Bind( someting(), (fun () -> async.Bind(sometingElse (), (fun () -> async.Zero())))), (fun () -> printfn "finally")) |> ignore
I get that the second part of TryFinally does not support cexpr .
f #
albertjan
source share