#5850: Greater customization of GHCi prompt
------------------------------+---------------------------------------------
 Reporter:  JamesFisher       |          Owner:                  
     Type:  feature request   |         Status:  new             
 Priority:  normal            |      Component:  GHCi            
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 GHCi is bit more than a Haskell interpreter.  With the {{{:!}}} and
 {{{:cd}}} commands, we have trivial access to the shell, making it often
 unnecessary to leave GHCi.  For this reason GHCi has become my *de facto*
 primary shell.

 The GHCi prompt therefore needs to show a bit more than just Haskell
 information.  Most importantly, the current working directory is often
 important to me.

 [http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/ghci-commands.html
 We can indeed customize the GHCi prompt] using {{{:set prompt}}}.  This
 takes the form of a string with a single escape sequence: {{{%s}}}, which
 is replaced with a list of currently loaded modules.

 Most shells allow arbitrary user customization of the prompt.  The
 {{{bash}}} prompt has [http://tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-
 prompt-escape-sequences.html numerous escape sequences for useful
 information], and if those aren't enough, it allows [http://tldp.org/HOWTO
 /Bash-Prompt-HOWTO/x279.html arbitrary command calls].

 GHCi should gain similar customization abilities.  Ways to implement this
 may include:

 1. addition of more escape sequences, like {{{%pwd}}}.

 2. addition of a single extra escape sequence with one parameter (an
 external command call), like like {{{%call(pwd --logical)}}}.

 3. redesigning the {{{:set prompt}}} option to take not a {{{String}}} but
 a Haskell function, like {{{[Module] -> IO String}}}.

 Option 2 would probably have the best power-to-simplicity ratio.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5850>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to