let flatMapU opt f = match opt with
| Ok x -> (f x [@bs])
| Error y -> Error y
which simply destructures and re-wraps the Error. While it works in this simple use case, I don’t think it is convenient when the number of constructor arguments increases
To add to this, there are a number of OCaml features that are available in ReScript that AFAIK aren’t documented in the ReScript documentation. I think it would be beneficial to include some documentation on them regardless of whether they’re discouraged. Some that come to mind:
type parameter constraints
universally qualified types
type parameter variance
let () =
Pervasives
All in all, though, I think the quality of documentation has improved tremendously since before the ReScript split and are continuing to rapidly improve.
Yeah, there’s still a few things that need to be added carefully (it shouldn’t invite users to start code golfing). Can you check the rescript-lang.org issue tracker and add issues for each topic? I know I added a few, e.g. subtyping / type coercion, but those are probably the hardest to write about (while maintaining our simple and short writing style).