Вопрос

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?

Это было полезно?

Решение 2

In GHC 7.8.1 and newer, you can change the continuation prompt using :set prompt2.

See GHC #7509.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top