In the book Real World OCaml, I find this code:
let command =
Command.basic
~summary:"Generate an MD5 hash of the input data"
Command.Spec.(
empty
...
+> anon (maybe_with_default "-" ("filename" %: file))
)
(fun use_string trial filename () ->
I see ()
in the last line (fun use_string trial filename ()
).
Also from Print a List in OCaml, I also see ()
in the first match.
let rec print_list = function
[] -> ()
| e::l -> print_int e ; print_string " " ; print_list l
Then, what's the meaning of ()
in both cases? How does the lambda expression (fun
) have ()
in its parameter list?