I don't understand how Optional and Result are fundamentally different here.
Conversation
My point is less about The Monad and more about being able to treat maybe-errors as a value.
1
'try?' doesn't foreclose on the ability to capture a maybe-error into a value.
1
It increases the inertia of Optionalish errors rather than Eitherish errors (i.e., an afterthought).
2
I want the bad path to receive as much compositional power and valueness as the good path.
3
3
The ability to abstract over 'throws' is admittedly weak. I hope we'll improve.
3
7
Throwing closures are definitely still very awkward, esp w/ async.
3
…then you try to compose with sequence operations and end up with Array<Promise<Result<T>>>...
1
1
2
4
You're probably really trying to asynchronously either produce an Array<T> or throw.
1
1
Replying to
Gotcha. And now you’re stuck `join`ing around until you get the `Promise<Result<Array<T>>` you wanted.
Replying to
This is why I think the sugar is still valuable. I just wish it applied to a real type.
Replying to
1
If you block the thread, you're not async/await. Coroutines are not blocking.
1
Show replies



