Currently this is how my ghci prompt looks like:
And I want to make it look like this:
or like this
Any ideas on how I can do this? My configuration(ghci.conf) file's contents is as shown below
:set prompt "\ESC[33m\STX[%s]\ESC[38;5;86m\STX \x03BB > \ESC[0m\STX"
in which I followed the syntax written on:
You can use prompt-function
instead of prompt
to run more advanced Haskell functions for the prompt. Here's an example ghci.conf
for your second prompt:
:{
prompter :: [String] -> Int -> IO String
prompter modules line = return $
concat [ "\ESC[33m\STX["
, Data.List.intercalate ", " modules
, "]\ESC[38;5;86m\STX \x03BB > \ESC[0m\STX"
]
:}
:set prompt-function prompter
Or, for numbers, you can utilize zipWith
:
:{
prompter :: [String] -> Int -> IO String
prompter modules line = return $
concat [ "\ESC[33m\STX["
-- this is the only line that changed
, Data.List.intercalate ", " $ zipWith (\n m -> concat [show n, ".", m]) [1..] modules
, "]\ESC[38;5;86m\STX \x03BB > \ESC[0m\STX"
]
:}
:set prompt-function prompter
I'll leave it as an exercise to write the continuation line, but it's very similar and just involves prompt-cont-function
.