Combining F# async functions

后端 未结 1 552
既然无缘
既然无缘 2020-12-11 19:51

I\'m a bit frustrated here. I know I\'ve got all the bits, but I can\'t work out how to combine them...

let saveImageToDisk path content =
    async {
               


        
相关标签:
1条回答
  • 2020-12-11 20:29

    You can combine the two using the async expression:

    let getImages imageUrls =
        imageUrls
            |> Seq.map (fun url -> async {
                  let! content = getImage url
                  return! saveImageToDisk (topath url) content })
            |> Async.Parallel
            |> Async.RunSynchronously
    
    0 讨论(0)
提交回复
热议问题