Closed jakubsvec001 closed 9 months ago
I don’t think this change is correct. From what I understand, x :: xs
adds the element x
onto the list xs
. Therefore, in terms of types, x
is of some type t
and the list xs
must then be of type t list
.
The proposed change would mean that x :: y
combines two elements x
and y
(of the same type) into a list. But this is not what the constructor ( :: )
does.
We can also see this in utop, for example by choosing t
as int
:
# 1 :: 2;;
^
Error: This expression has type int but an expression was expected of type
int list
I believe
e2 : t list
should bee2 :t
:Before: "If
e1 : t
ande2 : t list
thene1 :: e2 : t list
. " After: "Ife1 : t
ande2 : t
thene1 :: e2 : t list
. "