Я определил некоторые типы:
type box = Box of int
type table = Table of int
type compare_result = Lt | Eq | Gt
Кажется, что в OCaml мы не можем определить 2 функции с одинаковыми именами, но с разными типами аргументов:
let compare (a: box) (b: box): compare_result = (...)
let compare (a: table) (b: table): compare_result = (...)
let res_box = compare (Box 1) (Box 2) in (* which is supposed to call the first funciton *)
let res_table = compare (Table 1) (Table 2) in (* which is supposed to call the second function *)
ИтакМожет кто-нибудь сказать мне, что альтернатива в OCaml, чтобы сделать это?Должны ли мы называть эти две функции по-разному?