You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And in ~/.ghc/ghci.hs (obviously this isn't my real config, it's much simplified):
ghciInteractivePrint :: Show a => a -> IO ()
ghciInteractivePrint x = putStrLn "printing..."
ghciPromptFunction :: [String] -> Int -> IO String
ghciPromptFunction modules _lineno = pure "prompt> "
In plain ghci, everything works as expected:
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/gthomas/.ghc/ghci.hs, interpreted )
Ok, one module loaded.
Loaded GHCi configuration from /home/gthomas/.ghc/ghci.conf
prompt> 1
printing...
prompt>
Running cabal repl within a cabal project directory, somehow ghciPromptFunction is loaded but not ghciInteractivePrint:
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- hello-hs-0.1.0.0 (exe:hello-hs) (file app/Main.hs changed)
Preprocessing executable 'hello-hs' for hello-hs-0.1.0.0..
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/gthomas/.ghc/ghci.hs, interpreted )
Ok, one module loaded.
Loaded GHCi configuration from /home/gthomas/.ghc/ghci.conf
[1 of 1] Compiling Main ( app/Main.hs, interpreted )
Ok, one module loaded.
prompt> 1
1
prompt>
Running cabal repl outside of a project directory, everything fails to load, but there are at least visible errors (possibly only due to setcwd.ghci, which I can't find any mention of anywhere - what's the purpose of it?):
Resolving dependencies...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
- fake-package-0 (lib) (first run)
Configuring library for fake-package-0..
Preprocessing library for fake-package-0..
Warning: No exposed modules
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /home/gthomas/.ghc/ghci.hs, interpreted )
Ok, one module loaded.
<interactive>:1:1: error: Not in scope: ‘ghciInteractivePrint’
<interactive>:1:2: error:
Variable not in scope:
ghciPromptFunction :: [String] -> Int -> IO String
Loaded GHCi configuration from /home/gthomas/.ghc/ghci.conf
Warning: changing directory causes all loaded modules to be unloaded,
because the search path has changed.
Loaded GHCi configuration from /tmp/cabal-repl.-171000/setcwd.ghci
Prelude> 1
1
Prelude>
The text was updated successfully, but these errors were encountered:
Warning: changing directory causes all loaded modules to be unloaded,
because the search path has changed.
Loaded GHCi configuration from /tmp/cabal-repl.-171000/setcwd.ghci
setcwd.ghci is a configuration file generated by cabal repl that sets the working directory to a dummy temporary project (related: #6977). it may be that it causes /home/gthomas/.ghc/ghci.hs to be unloaded too.
i get a different but still problematic output in the project case
[...]
[1 of 1] Compiling Main ( /home/fgaz/.ghc/ghci.hs, interpreted )
Ok, one module loaded.
<interactive>:1:1: error: Not in scope: ‘ghciInteractivePrint’
<interactive>:1:2: error:
Variable not in scope:
ghciPromptFunction :: [String] -> Int -> IO String
Loaded GHCi configuration from /home/fgaz/.ghc/ghci.conf
[...]
This is with cabal-install 3.6.2.0, GHC 8.10.7, Manjaro Linux.
I have the following in my
~/.ghc/ghci.conf
:And in
~/.ghc/ghci.hs
(obviously this isn't my real config, it's much simplified):In plain
ghci
, everything works as expected:Running
cabal repl
within a cabal project directory, somehowghciPromptFunction
is loaded but notghciInteractivePrint
:Running
cabal repl
outside of a project directory, everything fails to load, but there are at least visible errors (possibly only due tosetcwd.ghci
, which I can't find any mention of anywhere - what's the purpose of it?):The text was updated successfully, but these errors were encountered: