Roughly speaking, an e1; e2OCaml typechecker is processed to express a form as follows:
e1 t -> t', 5.- else,
e1 unit, 10.
,
let f x =
prerr_endline "some side effect you may want";
(* but you may not want the returned function sometimes *)
fun y -> x + y
let a = f 1 2; f 1 2;; (* Warning 10 *)
let a = f 1; f 1 2;; (* Warning 5 *)
ignore e1; e2 e1; e2 : : 10 , e1 unit. 5 :
let a = ignore (f 1 2); f 1 2;; (* No warning *)
let a = ignore (f 1); f 1 2;; (* Warning 5 *)
So ignore 10, 5. ignore is_ignore funciton typing/typecore.ml OCaml.
5, 2 :
let a = let _ = f 1 in f 1 2;; (* No warning *)
let ignore' _ = ()
let a = ignore' (f 1); f 1 2;; (* No warning *)
- wild card. - ignore'. OCaml-, ignore, 5 , .