Skip to content

TryAsync prelude should have an overload that takes a Task #1278

Answered by louthy
pilotMike asked this question in Q&A
Discussion options

You must be logged in to vote

I realise that usage might be confusing, but there's reasons why I'm not going to change it:

  1. I'm planning on deprecating the Async based monadic types. I'm midway through this process on another branch, so making changes to functionality that will be deprecated is just looking for merge headaches that I don't need.
  2. Really, as functional programmers, everything should be an expression and therefore everything should return a value. There is an extension to Task called ToUnit() that you should apply to any Task you get from a 3rd party API as soon as you hold the value - it will convert your Task to Task<Unit>. Then make sure all the APIs under your control return values. It's a discipline…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pilotMike
Comment options

Answer selected by pilotMike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1271 on November 17, 2023 17:32.