GHC: Ticket #5850: Greater customization of GHCi prompt <p> GHCi is bit more than a Haskell interpreter. With the <tt>:!</tt> and <tt>:cd</tt> 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. </p> <p> 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. </p> <p> <a href="">We can indeed customize the GHCi prompt</a> using <tt>:set prompt</tt>. This takes the form of a string with a single escape sequence: <tt>%s</tt>, which is replaced with a list of currently loaded modules. </p> <p> Most shells allow arbitrary user customization of the prompt. The <tt>bash</tt> prompt has <a class="ext-link" href=""><span class="icon">​</span>numerous escape sequences for useful information</a>, and if those aren't enough, it allows <a class="ext-link" href=""><span class="icon">​</span>arbitrary command calls</a>. </p> <p> GHCi should gain similar customization abilities. Ways to implement this may include: </p> <ol><li>addition of more escape sequences, like <tt>%pwd</tt>. </li></ol><ol start="2"><li>addition of a single extra escape sequence with one parameter (an external command call), like like <tt>%call(pwd --logical)</tt>. </li></ol><ol start="3"><li>redesigning the <tt>:set prompt</tt> option to take not a <tt>String</tt> but a Haskell function, like <tt>[Module] -&gt; IO String</tt>. </li></ol><p> Option 2 would probably have the best power-to-simplicity ratio. </p> en-us GHC Trac 1.0.1 simonmar Tue, 07 Feb 2012 09:53:59 GMT difficulty, milestone set <ul> <li><strong>difficulty</strong> set to <em>Unknown</em> </li> <li><strong>milestone</strong> set to <em>7.6.1</em> </li> </ul> <p> I think the 3rd option would be the most general, and fits nicely. </p> <p> I don't have plans to tackle this in the short term, but by all means submit a patch. </p> Ticket igloo Wed, 12 Sep 2012 11:12:10 GMT milestone changed <ul> <li><strong>milestone</strong> changed from <em>7.6.1</em> to <em>7.6.2</em> </li> </ul> Ticket