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

Any chance of implementing let! ... and! ... #7

Open
pkese opened this issue Jun 15, 2020 · 5 comments
Open

Any chance of implementing let! ... and! ... #7

pkese opened this issue Jun 15, 2020 · 5 comments

Comments

@pkese
Copy link

pkese commented Jun 15, 2020

While I'm not sure if I understand that correctly,

it would be nice to be able to launch tasks in parallel using and! notation rather than launching them separately and then do! Task.WhenAll ...

i.e., instead of:

    let task1 = launchTask1()
    let task2 = launchTask2()

    do! Task.WhenAll [| task1 :> Task; task2 :> Task |]

    let! result1 = task1
    let! result2 = task2

i'd prefer to write:

    let! result1 = launchTask1()
    and! result2 = launchTask2()
@pkese pkese changed the title Any chance to implement let! ... and! Any chance of implementing let! ... and! ... Jun 15, 2020
@NinoFloris
Copy link
Member

Yes! This is a nice idea.

I'm open to a PR enabling applicatives, otherwise I'll probably implement it in one of the next versions!

@NinoFloris
Copy link
Member

Pending decision of sequential/parallel and! behavior for async dotnet/fsharp#10301

@pkese
Copy link
Author

pkese commented Nov 25, 2020

I think that they went into limitless recursion with that discussion and they'll just keep going on (i.e. they won't reach stack overflow until sometime mid 2023).

Maybe they just need some 'prior work' to refer to 😉
(...doesn't really matter, if it is async or asyncParallel)

@dsyme
Copy link

dsyme commented Nov 26, 2020

@NinoFloris @pkese I added a note about what the semantics of let! ... and! ... should be for Async<'T> dotnet/fsharp#10301 (comment)

Please take a look

@pkese
Copy link
Author

pkese commented Nov 26, 2020

That is a perfect explanation. Now I feel a bit ashamed for my sarcastic comment above 🤡

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

3 participants