I find ReScript to be quite interesting language, however AFAIK it doesn’t support any dedicated syntax for unwrapping Option type. We have to compare Option in the switch statement, or do some kind of flatMap/forEach/whatnot chain. ReScript even doesn’t offer destructing in if statement (like Rust’s if let Some(variable) = variable). Other languages implement such QoL syntax that way or another, so I think it’s pretty common issue:
[here goes Haskell “do” notation, but I’m new user, and cannot post more than two links]
All of these 3 mentioned have one thing in common: they change function signature to be of the same type. In Rust ? used on Option requires containing function to return an Option for example. In some sense it is the same function colouring that happens with async/await syntax in JS.
Such syntax would be incredibly helpful, I hope most of you can agree.
Did I miss something (there is such syntax or a good enough workaround [not just >any< workaround]), or maybe there was some discussion ongoing on that?