4 ms·
> type inference will always report errors in the correct function. Kinda! If you have a function calling another in apparent error, there are two functions t
by dllthomas 4y ago
> type inference will always report errors in the correct function.
Kinda! If you have a function calling another in apparent error, there are two functions that could be "the correct function" - maybe the call is wrong, or maybe the type signature on the called function is wrong (or potentially any of several called functions whose types interact in the calling function).
Now certainly you can report all of these locations, in which case the statement I quoted is true, but note that in principle you can also report all of the potentially involved locations when you have omitted some of the function type signatures.
You are very much correct that limiting the distance errors can drift is important in many contexts, and personally I strongly favor the "functions must have a signature" before a task in the code base is considered "done" (typically before merging to a shared repo), but I don't know that enforcing it in the language is the right call - deferring it during quick iteration until I've actually hit a potentially relevant type error is comfortable in Haskell, and in any case one has to be ready to add type signatures to better localize errors within a function.