I don't anderstand the behaviour of the try ... with ... feature of OCaml.
here is a little sample to reproduce my problem :
let () = try int_of_string "4" with | Failure -> -1 | n -> n
I compile with
ocamlc test.ml
Then I get this error:
File "test.ml", line 2, characters 6-23: 2 | try int_of_string "4" with Error: This expression has type int but an expression was expected of type unit
How can I modify my little code sample to make it work?