Greater customization of GHCi prompt
GHCi is bit more than a Haskell interpreter. With the
: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.
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.
GHCi should gain similar customization abilities. Ways to implement this may include:
- addition of more escape sequences, like
- addition of a single extra escape sequence with one parameter (an external command call), like like
- redesigning the
:set promptoption to take not a
Stringbut a Haskell function, like
[Module] -> IO String.
Option 2 would probably have the best power-to-simplicity ratio.