明确声明Int列表?

时间:2018-02-10 21:24:50

标签: ocaml reason

如何将let myList = [1, 2, 3];的类型明确标记为list of int's

我通过Try ReasonML尝试let xs: 'int list = [1,2,3];失败了。

1 个答案:

答案 0 :(得分:6)

原因为let xs: list(int) = [1,2,3];或OCaml为let xs: int list = [1; 2; 3]