Skip to content

Expose CWD and import search paths in GHCi via new `:show paths` command

  • Currently, GHCi provides a :cd command but no respective builtin command to query the currently set path.
  • Moreover, there's no obvious way to query the currently active importPaths dynamic flags field, to find out which -i options are currently in effect.

The attached patch extends :show with a :show paths subcommand, printing the CWD and the current value of importPaths:

Ok, modules loaded: Main, InteractiveUI, Paths_ghci_ng, GhciMonad, GhciTags.
λ> :show paths 
current working directory: 
  /home/hvr/Haskell/My/ghci-ng
module import search paths:
  dist/build/ghci-ng/ghci-ng-tmp
  ghc
  dist/build/autogen

λ> :set -i

λ> :show paths 
current working directory: 
  /home/hvr/Haskell/My/ghci-ng
module import search paths: none

> :cd /tmp
Warning: changing directory causes all loaded modules to be unloaded,
because the search path has changed.

> :show paths 
current working directory: 
  /tmp
module import search paths: none
Trac metadata
Trac field Value
Version 7.7
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
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