Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async.StartChild is not implemented / no Error or warning when used #1223

Closed
rommsen opened this issue Nov 6, 2017 · 3 comments
Closed

Async.StartChild is not implemented / no Error or warning when used #1223

rommsen opened this issue Nov 6, 2017 · 3 comments

Comments

@rommsen
Copy link

rommsen commented Nov 6, 2017

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

@alfonsogarciacaro
Copy link
Member

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! 👍

@rommsen
Copy link
Author

rommsen commented Nov 14, 2017

Thanks!

@alfonsogarciacaro
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants