Simplify implementation of eval plugin#3249
Closed
mpickering wants to merge 1 commit intohaskell:masterfrom
Closed
Simplify implementation of eval plugin#3249mpickering wants to merge 1 commit intohaskell:masterfrom
mpickering wants to merge 1 commit intohaskell:masterfrom
Conversation
The plugin was implemented by calling "load" which circumvents all of HLSs caching mechanisms for interface files and linkables. Instead we should work like the other typechecking functions which get all the stuff we need using HLS rules and setup the HscEnv with all the state in the right places. The key part to this is setting up all the HPT modules with linkables if they are depenedencies of the module we are trying to run a function from.
Collaborator
|
Would you like to add yourself to CODEOWNERS for this plugin? :) Since it's currently totally unloved. |
pepeiborra
approved these changes
Oct 8, 2022
Collaborator
pepeiborra
left a comment
There was a problem hiding this comment.
This looks great to me, but I'm far from an expert on the GHC interactive evaluation internals.
Comment on lines
-764
to
-782
| setupDynFlagsForGHCiLike :: HscEnv -> DynFlags -> IO DynFlags | ||
| setupDynFlagsForGHCiLike env dflags = do | ||
| let dflags3 = setInterpreterLinkerOptions dflags | ||
| platform = targetPlatform dflags3 | ||
| evalWays = Compat.hostFullWays | ||
| dflags3a = setWays evalWays dflags3 | ||
| dflags3b = | ||
| foldl gopt_set dflags3a $ | ||
| concatMap (Compat.wayGeneralFlags platform) evalWays | ||
| dflags3c = | ||
| foldl gopt_unset dflags3b $ | ||
| concatMap (Compat.wayUnsetGeneralFlags platform) evalWays | ||
| dflags4 = | ||
| dflags3c | ||
| `gopt_set` Opt_ImplicitImportQualified | ||
| `gopt_set` Opt_IgnoreOptimChanges | ||
| `gopt_set` Opt_IgnoreHpcChanges | ||
| `gopt_unset` Opt_DiagnosticsShowCaret | ||
| Compat.hsc_dflags <$> Compat.initializePlugins (Compat.hscSetFlags dflags4 env) |
Collaborator
There was a problem hiding this comment.
Why is it ok to skip this setup? It was copied from GHCi to try and replicate the same behaviour
Collaborator
|
Superseded by #3391 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The plugin was implemented by calling "load" which circumvents all of HLSs caching mechanisms for interface files and linkables. Instead we should work like the other typechecking functions which get all the stuff we need using HLS rules and setup the HscEnv with all the state in the right places.
The key part to this is setting up all the HPT modules with linkables if they are depenedencies of the module we are trying to run a function from.