Add let! and do! support for F# async / Async<'T>#114
Conversation
2bf9594 to
542472a
Compare
|
/cc @dsyme what do you think? |
|
@bartelink would you have an informed opinion on this method of setting the cancellation token? |
542472a to
e3524b5
Compare
|
I'm at the lower end of the 'informed' spectrum on this, but won't let that stop me opining... People could cope with this, and it's obviously terse. It's also arguably a dual to the But, to my eyes, it's not terribly searchable or scannable in the same way that e.g. However, this also begs questions like - would you ever want to setCT more than once? I can't think of any case where I'd only become aware of/generate the CT other than immediately when starting a Task? Is there any way the CT can become an argument to the builder? e.g. if the code could become Even if there was still a get out of jail card in the form of a for posterity, answers & follow up discussion: see #133. |
that’d most certainly be added as well. All CE methods are also supported in point free style. |
|
Why not using a CE Custom Operator for that ? |
EDIT: continued in PR #132. @gusty That would be my preference. Less magic, more explicitness. But last time I tried to mix "default" (yield!/let! etc) styles with ones that have custom operators, it all fell apart (but, to be fair, that was trying to add I didn't try it this time around, I'll give it a go. EDIT: tried it, failed it. I probably do something wrong here. Since there's zero docs on custom operations (apart from a few lines of explanatory text) I always have to figure it out by just trying. It compiles fine, but when I use This does not compile: It's also unfortunate that you need the extra parentheses... @gusty do you know if this can be fixed or is this a limitation of the language? Or perhaps a limitation of trying custom operations with resumable code? EDIT: see #132. |
2bf9594 to
9cb0ca4
Compare
let! and do! support for async and allow setting of CancellationTokenlet! and do! support for async ~and allow setting of CancellationToken~
let! and do! support for async ~and allow setting of CancellationToken~let! and do! support for F# async / Async<'T>
|
I shouldn't have conflated adding these two features in one PR. So I'm gonna split this up:
I've addressed the relevant questions there. Will continue this one with just the simple task of adding |
9cb0ca4 to
4c735e2
Compare
a53ce56 to
fb986ef
Compare
|
This will be published as part of 0.4.0. |
Fixes: #79
This introduces
asyncsupport similar to howtasksupportsasyncthrough let-bang and do-bang.Original PR contained the following, which has been moved to #132 and #133.
I'm not certain whether or not to allow this (creative?) approach of setting a
CancellationToken.Basically, if we'd merge this, setting a
CancellationTokencan be done as follows:@dsyme, what do you think? In a way I think it is smoother than adding overloads to all the
TaskSeq.XXXfunctions to take a cancellation token. Alternatively, of course, I could just have aTaskSeq.setCancellationTokenmethod. However, the above way is very flexible.The relatively simple way this is done is as follows:
Which may also be a way to allow cancellation tokens to be passed through in tasks (but, it adds overhead).