## Background
I have an enumerable over which I fold and call Task.async based on the data in the enumerable. I then Task.yield_many over the list of tasks, and use Enum.zip to correlate the original enumerable with the results.
I have a case where, during the fold I find that an entry is invalid for running Task.async. It would be convenient to create an "already completed" Task that contains an error result. For now, I'm still using Task.async to basically return an :error tuple, which of course starts and links a process.
Of course, I could work around this by using maps, etc.
I tried using %Task{} to create a "dummy" but calling Task.yield_many with such an entry always blocks until the timeout.
## Proposal
Add Task.completed/1 that creates an "already completed" Task that can then be awaited / yielded to return the result used when completed/1 was called:
```elixir
task = Task.completed({:error, :boom})
```
Awaiting or yielding on such a task returns the result immediately without invoking a process.
## Other
.NET has the following to achieve this behavior, for instance:
Thanks for your consideration! If approved I would gladly implement this.
Luke