-
Notifications
You must be signed in to change notification settings - Fork 8
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
Rename {find,canonicalize} to unsafe{Find,Canonicalize} #1
Comments
Thank you! I haven't given much thought to how one might end up using One thing that doesn't feel right with your proposal is that The Perhaps for more correctness we could have this be enforced with an So going back to |
In Haskell tradition “unsafe” means: when calling this function, there is a proof obligation that the type system can't discharge, and the programmer will have to prove themself. This is not the case of You are arguing otherwise, but I believe the “right” abstraction is to think of the egg data structure as a lazy e-graph (where the laziness is embodied by the actions deferred to the worklist). When you call
It is likely that you could so something like this. Also something with linear types ( 😊 ). Both sound more painful than they are worth (I mean, I certainly intend to push linear types until it's not unpleasant to do this sort of abstraction, but I wouldn't advise doing so today unless it has a lot of value). But honestly, I think that the simple way outlined in the original issue is really fine. |
I quite like the lazy e-graph framing. Under that light I must say it does make sense. I agree we can then have an I also do agree that both the monadic and linear types thing would be too much here, and that the proposed solution under that light is good. I'll leave the issue open and close it when we change the interface in a MR. Re: linear types: I'm a fan of linear types and of your work on Linear Haskell, and wanted to mention I wrote an undergraduate thesis on synthesis from linear types and more recently wrote a GHC plugin implementing the synthesis using GHC's 9.0 linear types :) (which I got to show to Mathieu at ZuriHac!) |
(This is getting very off topic, but this is very neat! I'd love to see you demonstrate it to me some time) |
Hello, and thanks for the good work.
This is a design proposal
Both
find
andcanonicalize
, as defined, are abstraction breaking, because the data structure is not in a sound state if you don't callrebuild
previously. My proposal, in keeping with the spirit of Haskell of correctness first is that:find
andcanonicalize
should callrebuild
before querying the data structure (note: in the case where the data structure is already rebuilt, then the work list is empty, thereforerebuild
will be very fast anyway)unsafeFind
andunsafeCanonicalize
would be introduced. With the documentation explaining that the onus is on the programmer to only call them on a “rebuilt” E-graph.The text was updated successfully, but these errors were encountered: