Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.typed by

I am applying core.typed to a project that processes sequences of fairly large hash-maps. I run into two issues:
1. The error output is to large to be interpreted by a human (4k per error)
2. The reported error seems to be incorrect as the expected-type and actual type seem to match.

I came to this conclusion by writing a function that compared the expected type and the actuals type. This function is included too and might be an example of how to produce more compact and readible output for errors on large hash-maps.

The longOutput.clj contains the function that fails (derive-sms_msg-fmt-fail ..) and the nearly similar function (derive-sms_msg-fmt ..) that passes (check-ns).

The file also contains function (show-error) which prints a copy of the type-error and subsequently analyses the derived type with the expected type. The derived type is a union of the expected type and some derivatives based on the inclusion of optional keys. So I as far as I can see the union is subtype of the expected type and the reported error is incorrect.

An example of the error-analysis is included in the file show-error.output.

3 Answers

0 votes

Comment made by: cvkemenade

PS: I could imagine that the current (show-error ..) could service as a basis for more compact error-messages on large hashmaps (using length of output as a criterium to decide whether the current error-format or the diffence-analysis results in the most compact error-report).

PS: I strongly believe in the big advantages of a static type-checker. But with the current error-messages it is nearly impossible to migrate a project involving large hash-maps due to the volumunuous error-output.

0 votes

Comment made by: ambrosebs

Hi Cees,

Thanks for the detailed report, it really helps. I'll look into this.

0 votes
Reference: https://clojure.atlassian.net/browse/CTYP-102 (reported by cvkemenade)