-
Notifications
You must be signed in to change notification settings - Fork 28
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
Ability to inspect when code doesn't type-check #84
Comments
I don't know enough about those options either. I asked around for ways to have the code compile even when types don't match so one could still inspect and got those 2 recommendations from folks on There's also Edit: @lwm |
Ah yes, I've opened #85 to track that. Yes, |
I've opened up #88 now. Hopefully @rdnetto or @parsonsmatt will chime in here to resolve this one. |
IMO, by default we should match the default behaviour of
The real reason we want this in the first place is that we want to inspect code that doesn't compile at all, regardless of whether that's due to a type error, a syntax error, or something else entirely. One way to achieve this might be to keep the old version of a module around if the new version fails to load. I think that fixing that for all compilation errors (rather than a subset) would be a better solution, though it's going to require changes in Intero which is obviously more work. |
@rdnetto aren't those two approaches somewhat conflicting? I don't see how it would be possible to have inspectable incomplete/broken code if you don't allow for partial/incomplete compilation and deviate from standard For instance:
|
You can get there if you inspect the latest working build, instead of the current state (which may be broken). (Deviating from the standard build options in a way not defined by the end user is the part here that bothers me, given it will almost certainly break due to some combination of incompatible options)
If the module/function has never compiled, there's not much we can do about it. Inspection needs to operate on a best-effort basis, given that code under development is going to be broken most of the time.
That's a more interesting question. One approach would be to always provide whatever information we have, and leave it up to the user to decide if it made sense or not. Another would be to check for things like differing type signatures, and invalidate the cached symbols based on that. What approach we take to invalidation will probably depend on the granularity of the cache though, which makes it hard to figure out until we've actually spiked or implemented it. |
This "broken" state might be something that we can work with and avoid some of the other hurdles. I'm now using the above mentioned options by default and it helps in some cases. |
I've been giving This leads to useless messages being displayed in the neovim status bar:
instead of
Regardless, the interactive session window provides all the information at the cost of manual scrolling when warnings/errors are too verbose. On the positive side, since the build succeeds, even in cases when types are incorrect, inspection of code is possible to some degree. |
The ability to inspect types and info about any function or variable relies on code compiling successfully.
The plugin is smart enough to keep previous information about types but often it leads to misleading or incomplete information when code moves up/down in the file.
ghc includes
-fdefer-type-errors
and-fdefer-typed-holes
(and possibly others) which allow for a successful compilation which fails type-checking.Would it make sense to include these options by default while using Intero in order to ensure we always keep the ability to inspect code?
The text was updated successfully, but these errors were encountered: