Re:Thoughts on Rust, a few thousand lines in
by brianberns on Wednesday January 09, 2019 @06:22PM
(#18870055)
Does Rust support a monadic coding style (like Haskell "do" blocks or F# computation expressions)? That would allow you to work with Options without having to explicitly unwrap them.
[ Parent
| on HN ]
Re:Thoughts on Rust, a few thousand lines in
by steveklabnik on Wednesday January 09, 2019 @06:31PM
(#18870116)
Yes, there are a bunch of methods that let you do this, though with a bit more syntax than do notation; for example, and_then is pretty much bind.
Re:Thoughts on Rust, a few thousand lines in
by TheCoelacanth on Wednesday January 09, 2019 @09:44PM
(#18871103)
Not generic monads, but it does have the `?` operator for Option (similar to Haskell Maybe) and Result (similar to Haskell Either) which would support a similar syntax to using `do` with the Maybe monad