ocaml.org
ocaml.org copied to clipboard
Code example errors in guide on error handling
I have been reading the guide on error handling at Error Handling · OCaml Documentation.
Overall I thought there was good advice in the advice, but I noticed a couple of errors in the code example using the result type with the let* bind operator. The example passes a Yaml.value entity to Result.map_error instead of a (Yaml.value, [`Msg of string]) result entity ; and the function passed to Result.map_error is of type string -> string by partial application of Printf.sprintf instead of type [`Msg of string] -> ....
The second issue also appears in the equivalent example code which uses the binary >>= operator, but not the first issue.