0

How can I explicitly mark the type of let myList = [1, 2, 3]; as a list of int's?

I tried let xs: 'int list = [1,2,3]; unsuccessfully through Try ReasonML.

Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
  • 1
    Note that the `'` prefix in front of a type marks it as a type variable. So it would be interpreted as something like `def xs[Int]: List[Int] = List(1, 2, 3)` – Yawar Feb 10 '18 at 21:39

1 Answers1

6

It's let xs: list(int) = [1,2,3]; in Reason or let xs: int list = [1; 2; 3] in OCaml.

vkurchatkin
  • 13,364
  • 2
  • 47
  • 55