来自异步工作流f#的回调函数

时间:2016-08-12 11:11:29

标签: asynchronous f#

我在这里有点腌渍。我似乎无法在计算的每一步做回调异步工作流程。这是我的代码

let criteria: state -> state -> bool = ...//criteria definition
let callback: state -> unit = ..../callback definition
let rec compute task state =
    async{
      ....// some long computations
      let task' = task.ContinueWith(fun _ ->callback(newState))
      if criteria state newState then return newState
      else return! compute task' newState
    }

0 个答案:

没有答案