I'm using StackExchange.Redis inside a small F# project and I need to cast the db.StringGetAsync() return value to an int. I've found a way to do it like this:
let! intFromRedis= async {
let! value = db.StringGetAsync(key) |> Async.AwaitTask
return int value
}
But it would be prettier to be able to do something like this instead:
// Better syntax but it does not compile
let! intFromRedis : int = db.StringGetAsync(key) |> Async.AwaitTask
Is there a better syntax for this?
|> intat the end?Async.mapTomas Petricek describes here: stackoverflow.com/a/6793961/126014Async.mapjust to maybe save one line of code.