You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactoring methods to return EitherAsync<L, R> rather than Task<Either<L, R>> can be a challenge sometimes since you can't use async/await. This is the error if you try to use async with EitherAsync as the return type (emphasis mine):
The return type of an 'async' method must be a 'void', 'Task', 'Task', a task-like type, 'IAsyncEnumerable', or 'IAsyncEnumerator'
This already exists for OptionAsync, but not for EitherAsync. This approach doesn't work for types with multiple generic arguments, because the C# team's hack to make async work through the god-awful attributes and GetAwaiter will only look for types with a single generic parameter.
Refactoring methods to return
EitherAsync<L, R>
rather thanTask<Either<L, R>>
can be a challenge sometimes since you can't useasync/await
. This is the error if you try to useasync
withEitherAsync
as the return type (emphasis mine):Based on https://devblogs.microsoft.com/premier-developer/extending-the-async-methods-in-c/#task-like-types I believe it would be possible to update OptionAsync, EitherAsync, etc to be usable as return types of async methods.
I noticed recently that I can now await these types (thank you!), so this would be an extra thing that makes them easier to use.
edit: more discussion here: #960
The text was updated successfully, but these errors were encountered: