I'm trying to wrap my head around how to accomplish the following task in F#. The following is a simplified C# pseudocode equivalent I'm looking to replicate.
var x = await GetXAsync();
if (x == null) return "not found";
var y = await GetYAsync(x);
return y;
My initial F# version looks something like:
task {
let! x = GetXAsync()
match x with
| None -> // need to return a hard-coded value here
| Some x` ->
let! y = GetYAsync(x`)
// More code
// return some value based on y here
}
Obviously this is terrible, but I'm unsure of how to proceed. Should I attempt a full ROP style of programming here, or is there something simpler?