-
Notifications
You must be signed in to change notification settings - Fork 119
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
cyclic evaluation in fixIO
on launch
#1012
Comments
I think the cryptol/src/Cryptol/TypeCheck/Monad.hs Line 121 in 2bdb0fa
This plays some very strange knot-tying games to lazily provide part of the computed output of the typechecking process as an input to the inference monad. This apparently makes parts of the typechecker very sensitive to strictness. 👎 Ultimately, the proximate cause is this line, which unintentionally increased the strictness demanded of a typechecked term, but only when call stacks are disabled: cryptol/src/Cryptol/TypeCheck/Infer.hs Line 376 in 2bdb0fa
|
The monadic recursion in the type checker is used to implement the dictionary passing, which is used to implement records. Basically, the issue is that we don't know how to rewrite record selections until we've solved the appropriate constraints (i.e., we've computed the dictionary). So the solution is that we rewrite with a thunk which is filled in when we solve the constraint later. It'd be a bit tricky to get around that, I think, at least with the current IR we have, as we can't abstract over selectors... I am totally open to alternatives, or at least ideas on how make bugs like that less likely to happen, as indeed this is some pretty tricky stuff. |
Yeah, it's a neat solution that avoids other hacks and/or traversing the terms twice... I don't know offhand a better way to do it. Maybe we should add some big comments somewhere describing which functions need to stay lazy, though. Perhaps that would help prevent issues like this in the future? |
One idea would be to add a constructor (say The +ve is that we can be quite free about being strict (as long as we don't force the field in |
Running with
--no-call-stacks
appears to cause a cyclic evaluation in fixIO. For example, from thecryptol
root directory:Omitting
--no-call-stacks
drops the user into a REPL as expected.The text was updated successfully, but these errors were encountered: