Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure stack ghci prompt

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.

like image 352
Răzvan Flavius Panda Avatar asked Feb 20 '18 22:02

Răzvan Flavius Panda


People also ask

What is stack Ghci?

stack ghci allows you to load components and files of your project into ghci . It uses the same TARGET syntax as stack build , and can also take options like --test , --bench , and --flag . Similarly to stack build , the default is to load up ghci with all libraries and executables in the project.

How do I run a Ghci file?

GHCi is the interactive interface to GHC. From the command line, enter "ghci" (or "ghci -W") followed by an optional filename to load. Note: We recommend using "ghci -W", which tells GHC to output useful warning messages in more situations. These warnings help to avoid common programming errors.

Where GHCi conf?

ghc/ghci. conf. Windows: C:\Documents and Settings\<username>\Application Data/ghc/ghci. conf.

How do I use Haskell Ghci?

If you have installed the Haskell Platform, open a terminal and type ghci (the name of the executable of the GHC interpreter) at the command prompt. Alternatively, if you are on Windows, you may choose WinGHCi in the Start menu. And you are presented with a prompt. The Haskell system now attentively awaits your input.


1 Answers

Try to put your config under:

~/.ghc/ghci.conf

Works for me on Ubuntu 16.04.

like image 159
Shersh Avatar answered Oct 17 '22 05:10

Shersh