7

Is it possible to configure stack ghci similar to the way ghci is configured via the ~/.ghci file?

Currently stack ghci does not pick up the settings in the ~/.ghci file.

I'm looking into setting the prompt to be a lambda instead of the loaded modules:

:set prompt "\ESC[33m\STXλ> \ESC[m\STX"

Update

[neo@nixos:~/HaskellLearning/IdeTest]$ stack ghci The following GHC options are incompatible with GHCi and have not been passed to it: -threaded Configuring GHCi with the following packages: IdeTest Using main module: 1. Package `IdeTest' component exe:IdeTest-exe with main-is file: /home/neo/HaskellLearning/IdeTest/app/Main.hs GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/neo/HaskellLearning/IdeTest/.ghci Loaded GHCi configuration from /home/neo/.ghci [1 of 9] Compiling Ch13
( /home/neo/HaskellLearning/IdeTest/src/Ch13.hs, interpreted ) [2 of 9] Compiling Ch15 ( /home/neo/HaskellLearning/IdeTest/src/Ch15.hs, interpreted ) [3 of 9] Compiling Ch17 ( /home/neo/HaskellLearning/IdeTest/src/Ch17.hs, interpreted ) ... Ok, 9 modules loaded. Loaded GHCi configuration from /run/user/1000/ghci31082/ghci-script *Main Ch13 Ch15 Ch17 Functor HelloError Lib Phone SemigroupAndMonoid>

None of the other 2 configurations mentioned does anything regarding changing the prompt.

Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169
  • I only use `stack ghci` and it definitely picks up the settings in my `~/.ghci` file. Is there something non-standard about your set-up? – jkeuhlen Feb 20 '18 at 22:53
  • have you set your `~/.ghci` file writable by just yourself? At least that's what my `stack ghci` complained about. – epsilonhalbe Feb 20 '18 at 23:07
  • I haven't changed the ~/.ghci permissions. Does using NixOS count as non-standard about the set-up? :) Still, if I just run ghci instead it will pick the settings. – Răzvan Flavius Panda Feb 20 '18 at 23:14
  • (You should probably say what the permissions were before you didn't change them.) – Daniel Wagner Feb 20 '18 at 23:18
  • `-rw-r--r--` and I am not getting any warning when running `stack ghci`. I'll update the question since it says it is using the settings but it is not applying them for some reason. – Răzvan Flavius Panda Feb 20 '18 at 23:38
  • I believe this is a NixOS issue as my config from `~.ghci` is being picked up in a Debian based distro. – Sibi Feb 21 '18 at 02:12

1 Answers1

1

Try to put your config under:

~/.ghc/ghci.conf

Works for me on Ubuntu 16.04.

Shersh
  • 9,019
  • 3
  • 33
  • 61