The m1 and m2 in the following functions have compiling errors.
let m p = async { return p * 2 }
let m1 () = async { do! m 2 } // ERR: was expected 'int' but here has type 'unit'
let m2 () = async { do! m 2 |> ignore } // ERR: expecting 'Async<int>->Async<'a>' but given 'Async<int>->unit'
m is called at the last line. How to ignore its return value? Is the following the only way (will executing of it be optimized by the compiler?)?
let m1 () =
async {
let! x = m 2
()
}