swarm-game / swarm

Resource gathering + programming game
Other
834 stars 53 forks source link

Try implementing "A practical framework for type inference error explanation" #109

Open byorgey opened 3 years ago

byorgey commented 3 years ago

Giving good error messages when type inference fails is notoriously tricky. In A Practical Framework for Type Inference Error Explanation, Loncaric et al. give a framework for essentially doing type error slicing (pointing to the places in the code that contributed to a type error) while treating type inference more or less as a black box. The idea is to take the set of constraints generated by type inference and try to find a minimal (or at least small-ish) subset such that removing them causes the constraint solver to succeed, and point to the places where those constraints were generated. The results seem on par with other approaches to the problem, with a much simpler and more language-agnostic implementation. I'd like to try implementing this, partly because it might give us nice error messages, and partly because I am shamelessly using Swarm as a laboratory for learning about cool PL techniques.

I have read carefully through the paper and it seems like implementing it shouldn't be too bad. In particular, it would require:

byorgey commented 2 years ago

I think it's still worth doing #99 first, since that should be much simpler. I don't really know if and when I will get around to this.