[Haskell-cafe] customizing haskeline?

Evan Laforge qdunkan at gmail.com
Mon Apr 15 04:22:20 CEST 2013


I tried to colorize a haskeline prompt by putting control characters
in it, but line editing was hopelessly confused, presumably because
haskeline doesn't understand control characters and thought the prompt
was longer than it really was.  From looking at
Haskeline.promptedInput, it seems like there's no way to set the
prompt to a higher level terminal operation since it's hardcoded to
String, and there's no way to tell it how many displayed characters
the prompt contains.

So is there some way to have a fancy prompt that I'm missing?  Has
anyone done that successfully?

This also implies it's impossible for haskeline to cooperate with
cursor addressing in general. Or maybe it would be ok as long as I
don't do anything fancy on the prompt line.  But also seems like you
can't set custom keybindings, e.g. bind a control key to a "history
menu" like shells can do, which is my real goal here.  I guess I'm
interested if anyone has been able to use haskeline for anything more
complicated than a prompt with the hardcoded default behaviour.  My
impression is that it's basically non-extensible, but maybe there's
some hook I'm missing.

By extension it seems impossible to colorize a ghci prompt, and indeed
embedding control characters directly in :set prompty leads to the
same problems.



More information about the Haskell-Cafe mailing list