GnuVince
07-14-2002, 10:27 PM
Is it possible to match types in O'Caml? For example (this does not work, of course):
let print_any t = match t with
int -> print_int
| string -> print_string
| char -> print_char
| _ -> raise "DoH!"
;;
Is there any way to do this? Thanks a lot.
let print_any t = match t with
int -> print_int
| string -> print_string
| char -> print_char
| _ -> raise "DoH!"
;;
Is there any way to do this? Thanks a lot.