hazel
hazel copied to clipboard
Polymorphic equality
In progress handling #1252.
Front-end tests:
test 1 == 2 end;
test 1. == 1. end;
test false != false end;
test "str" == "str" end;
test [1,2] != [2,1] end;
test (false, "") == (false, "") end;
type T = +A+B(Int) in
test A == B(1) end;
test A == A end;
#Static Error: type inconsistent#
1 == 1.;
"" == false;
#Static Error: type contains arrow#
let f = fun x -> x in
f == f;
string_compare == string_compare;
let a : +A+B(Int->Int) = in
a == a;
let a : rec R -> A(Int->Int) + R = in
a == a;
let a = typfun A -> fun x : A -> x in
a == a;
let a = (1, [f]) in
a == a;
#Dynamic Error: type inconsistent#
let a : ? = 2. in
1 == a;
#Dynamic Error: type contains arrow#
let f : ? = fun x -> x in
f == f