阻止 ghci 在提示中显示模块

stopping ghci from displaying modules in the prompt

当我在 ghci 中启动会话时,我使用:

:set prompt >> 

但是,某些函数调用在计算时仍会在提示符处显示模块名称。我想,除了我的自定义提示,我什么都不想要。

  1. 如何禁止显示?
  2. 提示到底想告诉我什么?为什么它只对某些函数调用而不是所有函数调用执行此操作?我不明白发生了什么事的逻辑。

实际 ghci 输出:

>>m00 <- iOIandRTfromPhrase 0.25 2 2 4 [2] 2 [2] 4.0 3                                                                                                       
>>rs <- newMMap [("100",m00)]                                                                                                                                
>>:{                                                                                                                                                         
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List| let lsysTest rules axiom gen phraseLength = do                                                                                                                           
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List|     f <- flatRandomPattern gen rules axiom [0.25,0.5..1.5] phraseLength                                                                                                  
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List|     return f                                                                                                                                                             
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List| :}         
>>:{                                                                                                                                                         
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List| let lsysTestB rules axiom gen iois phraseLength = do 
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List|     f <- flatRandomPattern gen rules axiom iois phraseLength
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List|     return f                                                                                                                                                             
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List| :}         
>>         

似乎设置 prompt-cont 不会改变输出。

:set prompt-cont |
Some flags have not been recognized: prompt-cont, |
:{
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List| let lsys rules axiom gen phraseLength iOIs = do

回答,从左下角开始:较旧的 ghci 需要设置 prompt2。较新的版本可能需要不同的命令,如下面的评论所述。

好的,这确实是提示问题,但不是prompt问题。 :{ :} GHCi 中的延续使用不同的提示符,即 prompt-cont

GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
Prelude> :set prompt >>
>>:set prompt-cont | 
>>:{
|let foo :: [Int]
|    foo = [37, 9, 18]
|:}
>>foo
[37,9,18]

在旧的 GHCi 版本中,prompt-cont 被称为 prompt2:

GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
Prelude> :set prompt >>
>>:set prompt2 |
>>:{
|let foo :: [Int]
|    foo = [37, 9, 18]
|:}
>>foo
[37,9,18]

如果您喜欢具有在本地代码块中定义函数的适当功能的 REPL,我建议您也查看 IHaskell。 GHCi 对此的支持总是有点繁琐。