haskell - 停止 ghci 在提示符中显示模块

标签 haskell prompt read-eval-print-loop ghci

当我在 ghci 中开始 session 时,我使用:

:set prompt >> 

但是,某些函数调用在评估时仍会在提示符处显示模块名称。我想,除了我的自定义提示之外,我从不想要任何东西。
  • 如何抑制此显示?
  • 究竟是什么提示试图向我展示?为什么它只对某些函数调用而不是全部这样做?我不明白正在发生的事情的逻辑。

  • 实际的 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



    回答,从下面的 leftaroundabout 开始:较旧的 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]
    

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

    关于haskell - 停止 ghci 在提示符中显示模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51533529/

    相关文章:

    haskell - 在 ghci 下执行 `(read "[红色 ]")::[Color]` 时会发生什么?

    objective-c - BetterAuthorizationSample 提示未更改

    scheme - 是否可以从Racket REPL内查看函数的源代码?

    haskell - 如何在 Haskell 中产生无穷大?

    haskell - 为什么一个简单的 Python/Haskell/etc 程序在导入时会卡住/挂起?

    haskell - 将两个关联列表与正在运行的累加器合并

    ruby , pry 开: Can I add something to the command `pry example.rb` so pry automatically goes interactive when it finishes executing the script?

    c# - 自定义 PowerShell 提示符 - 相当于 CMD 的 $M$P$_$+$G?

    javascript - 自定义 JS 提示弹窗

    console - 从控制台进行更大的测试日志记录