-
-
Notifications
You must be signed in to change notification settings - Fork 391
Simplify implementation of eval plugin #3249
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
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.
Would you like to add yourself to CODEOWNERS for this plugin? :) Since it's currently totally unloved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me, but I'm far from an expert on the GHC interactive evaluation internals.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it ok to skip this setup? It was copied from GHCi to try and replicate the same behaviour
Superseded by #3391 |
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.