2
我有做一些IO與此簽名的方法:F#異步和匿名函數
member this.IsRestaurantInCatagoryAsync(restaurantName: string, restaurantAddress: string, restaurantCatagory: string) =
async { ///long running methods }
我想調用它在一個匿名函數,像這樣:
this.GetRestaurants()
|> Seq.filter(fun (name, address) -> catagoryRepository.IsRestaurantInCatagoryAsync(name, address,catagory))
|> Seq.toList
的問題是, IsRestaurantInCatagoryAsync返回一個異步,而不是一個布爾。我如何讓Seq.Filter處理它?我應該使用let將異步投射到布爾!那麼我必須編寫一個非匿名函數來分配返回值?
是否有任何計劃將Seq.FilterAsync等添加到F#規範中? –