MONADS AND RUST A THREAD
- or -
why async/await instead of do notation
Conversation
Let's start with borrowing across yield points. We've solved this problem for real yield points with pin, I have no idea how to solve it using a function interface like >>=
2
5
25
So that means borrows across statements in do notation are just out of the picture. That's extremely limiting.
2
3
20
Rust's imperative control flow statements like `return` and `break` inside of do notation also doesn't make sense, because we do not have TCP preserving closures.
3
4
21
So we only know how to have do notation without early return or borrowing. People say this is an open research question, but IMO its just not possible within our runtime constraints.
2
4
19
I guess the trouble I have with this position is that Rust was founded on proving that you could have your cake and eat it wrt. safety and performance. Why should it also be impossible to have safety, perf, and category theory based abstractions in another future language?
1
I realise you are pushing back against those folks who don't understand the problem with how Rust is explicit about fusing stuff like iterators and functors, but I do worry about pushing _too far_ the other way and creating a new generation of naysayers. 🙁
Replying to
possibly if the language were semantically much closure to haskell (almost certainly needs to be pure for example)
1

