[GHC] #11069: :cd in GHCi unloads modules

#11069: :cd in GHCi unloads modules -------------------------------------+------------------------------------- Reporter: mgsloan | Owner: Type: bug | Status: new Priority: low | Milestone: Component: GHCi | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If I run `stack ghci` in the [https://github.com/commercialhaskell/stack stack] repo, and then use `:cd`, I get the following:
Warning: changing directory causes all loaded modules to be unloaded, because the search path has changed.
And, indeed, all modules are unloaded. What's particularly strange about this is that in my case all of the paths provided on the commandline are absolute. Here's the output of ":show paths":
current working directory:
/home/mgsloan/fpco/stack
module import search paths:
/home/mgsloan/fpco/stack/src
/home/mgsloan/fpco/stack/.stack- work/dist/x86_64-linux/Cabal-1.22.4.0/build/autogen
/home/mgsloan/fpco/stack/.stack- work/dist/x86_64-linux/Cabal-1.22.4.0/build
/home/mgsloan/fpco/stack/src/main
How about removing any dependency in GHC on the current working directory, and instead store it when the session is initialized? This is also necessary if we want to support per-package working directories, [https://ghc.haskell.org/trac/ghc/timeline?from=2015-11-08T06%3A17%3A58Z&precision=second details here]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11069 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

How about removing any dependency in GHC on the current working
#11069: :cd in GHCi unloads modules -------------------------------------+------------------------------------- Reporter: mgsloan | Owner: Type: bug | Status: new Priority: low | Milestone: Component: GHCi | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): directory, and instead store it when the session is initialized? Go ahead. GHCi is just as unmaintained as hpc, so it's all yours to fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11069#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

How about removing any dependency in GHC on the current working
#11069: :cd in GHCi unloads modules -------------------------------------+------------------------------------- Reporter: mgsloan | Owner: Type: bug | Status: new Priority: low | Milestone: Component: GHCi | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Replying to [comment:1 thomie]: directory, and instead store it when the session is initialized?
Go ahead. GHCi is just as unmaintained as hpc, so it's all yours to fix.
Whoa. I don't think of GHCi as unmaintained. The debugger in GHCi is regrettably unmaintained. But the rest of it gets active work, no? And I don't agree with the proposed change. I may be an exception to the normal Haskell workflow, but I do most of my work in GHCi without reference to a cabalized package. (Usually, I'm just testing different constructs, not building a project intended for release.) I use `:cd` and expect it to change my working directory used for finding modules. If I understand correctly, the proposed change would eliminate this workflow. (I do find it annoying that all my modules get unloaded when I move directories, as that's not always my intent.) So I think a bit of a larger discussion is in order before making this breaking change. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11069#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11069: :cd in GHCi unloads modules -------------------------------------+------------------------------------- Reporter: mgsloan | Owner: Type: bug | Status: new Priority: low | Milestone: Component: GHCi | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mgsloan): My understanding is that it's unloading the objects because relative paths are being used within GHC. [https://ghc.haskell.org/trac/ghc/ticket/2973 This issue] seems relevant, but Simon's commit message "we should virtualise the CWD inside the GHC API, not in the client" suggests to me that we'd prefer that GHC not care about CWD. To me, the ideal resolution is to use absolute paths within GHC, but perhaps this is a tall order. For example, `:load` would convert relative paths to absolute. Then, modules don't need to be unloaded for `:cd` to work. An alternative solution for my particular case would be to have `:cd` not unload the modules if all of the search paths are absolute. This is the case when ghci is run by `stack ghci`, and probably when it's run by `cabal repl` as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11069#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC