bug (?) in type checking of record update
Ross Paterson
ross@soi.city.ac.uk
Wed, 12 Feb 2003 15:44:05 +0000
Jeff,
I think this unification should be re-instated:
--- type.c 12 Feb 2003 05:49:14 -0000 1.64
+++ type.c 12 Feb 2003 15:42:34 -0000
@@ -1814,11 +1814,8 @@
instantiate(t);
shouldBe(line,snd(f),e,update,arg(fun(tr)),or);
} /* Unmentioned component */
- /* this is just a sanity check, and avoiding it lets us
- handle records with polymoprhic components
else if (!unify(arg(fun(td)),od,arg(fun(tr)),or))
internal("typeUpdFlds");
- */
tr = arg(tr);
td = arg(td);
It always succeeds, because it just unifies the type variable for the
input field with the one for the output one, but this affects the type
of the expression, and may trigger later errors, e.g. we currently have
data Container a = Container { contents :: a, info :: String }
Hugs> :t Container { contents = True, info = "foo" } { info = "bar" }
Container{contents = True, info = "foo"}{info = "bar"} :: Container a
Would that break records with polymorphic components?
Ross