deech / shen-elisp

125 stars 11 forks source link

Better error message on wrong types #12

Open MHOOO opened 8 years ago

MHOOO commented 8 years ago

When passing a wrong type to a typechecked function, the resulting error simply prints "type error" without any further information, such as the stacktrace, expected type and argument number.

Would it be difficult to add this information?

deech commented 8 years ago

This is the default behavior of Shen which is unfortunately counterintuitive to anyone coming from ML style type systems.

Whenever you see that, try doing (spy +) at the REPL. This toggles a "type level debugger" that allows you to step through the deductions.

See http://www.youtube.com/watch?v=BUJNyHAeAc8&t=14m7s which addresses this specifically.