Fable: Async.StartChild is not implemented / no Error or warning when used

Created on 6 Nov 2017  路  3Comments  路  Source: fable-compiler/Fable

Description

Hi there. I am trying to build Async Tasks for our elmish application. I want to execute two async request in parallel and apply their responses to my results (applicative style). My problem is that I need to start two (or more) different Asyncs in parallel and I can not use Async.Parallel because the Asyncs are wrapping different Result Types. The problem is, that Async.StartChild does not seem to be implemented in Fable but I do not get any compile Errors or warnings in the browser dev tools.
The async requests are just never executed. Does anybody have a hint how to achieve what I want?

Repro code

type Task<'Result, 'Error> =
  Async<Result<'Result, 'Error>>

let private (<!>) = Result.map
let private (<*>) = Result.apply

let map2Parallel func taskA taskB =

  async {

    let! result1Async = taskA |> Async.StartChild // start first request but do not wait
    let! result2Async = taskB |> Async.StartChild  // start second request in parallel

    let! result1 = result1Async
    let! result2 = result2Async

    let result =
      func <!> result1 <*> result2

    return result
  }

Expected and actual results

Expected: Both async operations are started.
Actual: Nothing happens and there is neither a compile error nor a warning/error in the browser console

All 3 comments

Hmm, you're right Async.StartChild is not implemented yet. I guess it should be possible to do it, I'll have a look. Thanks for pointing it out! 馃憤

Thanks!

Thanks to you! The fix will be published in next Fable 1.3 beta version. Hopefully today :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments

MangelMaxime picture MangelMaxime  路  3Comments

stkb picture stkb  路  3Comments

theprash picture theprash  路  3Comments

alfonsogarciacaro picture alfonsogarciacaro  路  3Comments