GHCi's prompt can be set as follows, which is in my .ghci
:
:set prompt "λ> "
However, a different prompt appears in multiline blocks, and I can't figure out how to change it. It is completely unreadable if too many modules are imported:
λ> :{
Prelude Control.Arrow Control.Applicative Control.Monad Control.Concurrent Control.Concurrent.Async Control.Parallel Data.String Data.Char Data.List Data.Maybe Data.Monoid Control.Monad.IO.Class|
Is there a way to set this secondary prompt? Alternatively, are there other good ways to run Haskell interactively where multiline expressions are displayed in a more friendly manner?
Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)
Prelude is a module that contains a small set of standard definitions and is included automatically into all Haskell modules.
Introduction. GHCi is GHC's interactive environment, in which Haskell expressions can be interactively evaluated and programs can be interpreted.
You can't use prompt2
for GHC 8.2.1 and newer anymore because interface is changed. Previously it was:
:set prompt <prompt> set the prompt used in GHCi
:set prompt2 <prompt> set the continuation prompt used in GHCi
Now it's:
:set prompt <prompt> set the prompt used in GHCi
:set prompt-cont <prompt> set the continuation prompt used in GHCi
:set prompt-function <expr> set the function to handle the prompt
:set prompt-cont-function <expr> set the function to handle the continuation prompt
Some typical usages of these functions (just type in your GHCi or add in ~/.ghc/ghci.conf
to apply settings globally):
:set prompt λ:
:set prompt-cont λ|
or
:set prompt ghci>
:set prompt-cont ghci|
Note: space at the end of each line
In GHC 7.8.1 and newer, you can change the continuation prompt using :set prompt2
.
See GHC #7509.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With