When we see a let x = y in z if we have a type annotation on x, we can check both y and infer z in parallel.
Even if we don't use parallel processing here, we can report both errors instead of just one. So, if let x: Foo = y in z if y doesn't type check as Foo we fail currently without checking anything for z, but we don't have to. We can assume the type of x is Foo and also report any errors in z.
A similar issue comes up when you have a series of lets and the next items may not depend on the previous:
x = foo
y = bar
z = baz
f(x, y, z)
In this example, even without a type annotation, we could potentially collect all the errors on x, y, z before going on to f(x, y, z).
When we see a
let x = y in z
if we have a type annotation on x, we can check bothy
and inferz
in parallel.Even if we don't use parallel processing here, we can report both errors instead of just one. So, if
let x: Foo = y in z
if y doesn't type check asFoo
we fail currently without checking anything forz
, but we don't have to. We can assume the type ofx
isFoo
and also report any errors inz
.A similar issue comes up when you have a series of lets and the next items may not depend on the previous:
In this example, even without a type annotation, we could potentially collect all the errors on x, y, z before going on to
f(x, y, z)
.