Skip to content

:cd in GHCi unloads modules

If I run stack ghci in the 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, details here.

Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information