标签: ocaml reason
如何将let myList = [1, 2, 3];的类型明确标记为list of int's?
let myList = [1, 2, 3];
list of int's
我通过Try ReasonML尝试let xs: 'int list = [1,2,3];失败了。
let xs: 'int list = [1,2,3];
答案 0 :(得分:6)
原因为let xs: list(int) = [1,2,3];或OCaml为let xs: int list = [1; 2; 3]。
let xs: list(int) = [1,2,3];
let xs: int list = [1; 2; 3]