Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stopping ghci from displaying modules in the prompt

When I start a session in ghci, I use:

:set prompt >> 

However, some function calls still display module names at the prompt when evaluated. I never want anything other than my custom prompt, I think.

  1. How do I suppress this display?
  2. What exactly is the prompt trying to show me? Why does it only do this for some function calls and not all of them? I don't understand the logic of what is happening.

Actual ghci output:

>>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| :}         
>>         

Setting prompt-cont doesn't change the output, it seems.

: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

Answer, from leftaroundabout below: older ghci needs set prompt2. Newer versions might require different commands, as described in comments below.

like image 553
renick Avatar asked Jul 26 '18 07:07

renick


1 Answers

Ok, that is indeed a prompt problem, but not a prompt problem. :{ :} Continuations in GHCi use a different prompt, namely 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]

In older GHCi versions, prompt-cont was called 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]

I recommend you also check out IHaskell if you like a REPL with proper capability of defining functions in local code blocks. GHCi's support for this was always a bit fiddly.

like image 158
leftaroundabout Avatar answered Oct 27 '22 23:10

leftaroundabout