-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type checking should use whnf, not normal form #3199
Comments
Consider
Here Why so? Here I would have expected |
Although this is not a self-contained example, I am adding it here to further illustrate the potential consequences of the issue pointed out by Edwin. It is a nice example, I think. We basically want to show that 1/8 = 3/24. Here it goes:
The program type checks almost instantaneously. But commenting out
on a Intel Xeon E5-2690v3 12c/2.6GHz CPU! |
I'm no longer convinced that this is a good idea, simply because I've tried it and sometimes it leads to horrific slowdowns. I think, unfortunately, a much more drastic rewrite is necessary in order to get better performance from the type checker in cases like this, without spoiling it elsewhere. Still, I'm leaving this open because we need to deal with this kind of issue. But it's way harder than it seems at first due to some implementation decisions I made years ago that turn out to be bad. |
For posterity, could you say what those bad decisions were and why? |
The following program should type check more or less instantly, but doesn't:
The reason is that the type checker just uses normalisation by evaluation, so needs to produce a normal form for 100 * 100, whereas weak head normal form would be enough and would evaluation to S [stuff] instantly.
I've been meaning to implement this for about 4 years, but have still not got around to it. It really needs doing before version 1.0, however, and should address the underlying problem described in #3198
The text was updated successfully, but these errors were encountered: