Search code examples
haskellpromptghci

Set prompt in Haskell


I'm new in Haskell

Instead of the:

Prelude>

I want GHCi to prompt

GHCi>

I wrote

:set prompt "GHCi> "

but when I close GHCi and open it again it show me

prelude

again. I saw that I need to create a file called .ghci in my home folder and set its to contents to

:set prompt "GHCi> ".

How can I create this file and set the prompt. Thank You for your answers


Solution

  • You can make a .ghci file that specifies the configuration of your GHCi environment.

    For a *nix system, that is often located at the ~/.ghci, for a Windows system, that is apparently located at appdata/ghc/ghci.conf where appdata is often C:/Documents and Settings/user/Application Data.

    You can thus write to this .ghci (or ghci.conf) file a set of instructions to do when opening the GHC shell, like:

    :set prompt "GHCi> "
    

    GHCi will furthermore probably require to set the permissions to the file, for example on a Linux system with:

    chmod go-w ~/.ghci
    

    such that the group and other users can not write to the file.