Closed stellarhoof closed 6 years ago
The main complication here is that loading a file can potentially be really expensive. Intero will reload and recompile everything that it needs to.
Yeah I agree loading a file can be really expensive, but ghci already does that when it starts. At least in my setup, whenever I stack ghci
, all the modules in the project get compiled to bytecode beforehand, because they are "interpreted". At this point, using :m + *Module
is inexpensive, since it doesn't do a full load of the file, it just adds Module
definitions to the current scope.
Adding my voice here to say that the current behavior really tripped me up. It feels unintuitive. I understand the hesitation regarding the demands of loading the file. But this is done async, no?
Another issue is that file loading in stack projects is best done via setting the relevant target -- otherwise you're going to get weird GHCi flags. Consider an executable with ImplicitPrelude
enabled and a library with NoImplicitPrelude
. If you load the library as a target and try to :load
the executable Main.hs
file, you'll get errors due to the GHCi flags used.
Seems like we may want to have two divergent behaviors: one for "I am in a stack project" and another for "there's no stack project, just load the file."
Closing as a duplicate of #69
Currently, when
InteroStart
,InteroOpen
, etc... are invoked, only the main module is in scope. This is confusing when trying to get the type for a module other than the main one. For example, if I haveMain.hs
andParser.hs
and invokeInteroStart
fromParser.hs
,Parser
imports won't be in scope, which is probably not what the user intends.Moreover, it might be a good idea to do the same on
BufEnter
? I'm not sure if this will have a big impact on performance or it might affect usability.Alternatively, instead of loading the module, we could also just replace the current
ghci
scope to contain only that module with (for example):m + *Parser
. This wouldn't work so well for completion (discussion in #5), but we can play around with different settings, any of which I believe would be an improvement.