阻止ghci在提示符中显示模块

ren*_*ick 5 haskell prompt ghci read-eval-print-loop

当我在ghci中开始一个会话时,我使用:

:set prompt >> 
Run Code Online (Sandbox Code Playgroud)

但是,某些函数调用在评估时仍会在提示符处显示模块名称.我想,除了我的自定义提示,我从不想要任何其他内容.

  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| :}         
>>         
Run Code Online (Sandbox Code Playgroud)

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

:set prompt-cont |
一些标志尚未被识别:prompt-cont,|
:{
*ExperimentalConductive ExperimentalConductive Music.Theory.Bjorklund SuperDirtAction NonlinearEnsemble EnsembleNew Control.Concurrent Data.List | 让lsys规则axiom gen phraseLength iOIs = do

答案,从左下方开始:较旧的ghci需要设置提示2.较新版本可能需要不同的命令,如下面的注释中所述.

lef*_*out 5

好吧,这确实是一个提示问题,但不是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]
Run Code Online (Sandbox Code Playgroud)

在较旧的 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]
Run Code Online (Sandbox Code Playgroud)

我建议您也检查一下IHaskell您是否喜欢具有在本地代码块中定义函数的适当能力的 REPL。GHCi 对此的支持总是有点繁琐。