ocaml.org icon indicating copy to clipboard operation
ocaml.org copied to clipboard

Code example errors in guide on error handling

Open ChrisVine opened this issue 1 year ago • 0 comments

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.

ChrisVine avatar Mar 18 '24 12:03 ChrisVine