I'm trying to write something like this:
type 'a 'b xxx = {aaa: 'a: bbb: 'b: ccc: int};;
It does not compile. Is it just syntax error, or they don't allow multiple paramters on type ? Then why ?
In ML, multiple type parameters are written between parentheses and separated by commas, like this:
type ('a,'b) xxx = {aaa: 'a; bbb: 'b; ccc: int; }
Actually you can write like this, in revised syntax :
Objective Caml version 3.11.2
# #load "dynlink.cma";;
# #load "camlp4r.cma";;
Camlp4 Parsing version 3.11.2
# type xxx 'a 'b = { aaa : 'a; bbb: 'b; ccc: int};
type xxx 'a 'b = { aaa : 'a; bbb : 'b; ccc : int }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With