FYI: rlwrap ghcii.sh works (Re: GHCi completion on windows?)
kr.angelov at gmail.com
Fri Jul 4 05:16:54 EDT 2008
There is a native port of readline to Windows from gnuwi32 here:
It is rather flaky but I did some fixes in the C library and now it
works very well. The Haskell binding also just works. You can find the
On Thu, Jul 3, 2008 at 11:53 PM, Claus Reinke <claus.reinke at talk21.com> wrote:
>>> while undocumented (?), there seems to be a lot of code
>>> in GHCi regarding commandline completion. but in a
>>> default build, i don't get any benefit from that, as editline
>>> doesn't seem available for mingw (?).
>>> is there a way to get this working on windows? i'm growing
>>> rather tired of typing VeryLongCamelCaseLanguageExtensions
>>> in GHCi sessions, and this would help!-)
>>> if there really is no working editline for windows, is there a
>>> way of pluggin in Malcolm's System.Console.SimpleLineEditor (currently in
>>> package readline), extended to handle completion?
>>> the completion code itself is in haskell, anyway, just that there's
>>> no editline/readline to call this code on windows, right?
>> Yes, exactly. I believe at one stage there was a readline C library
>> available for mingw, and we could build the Haskell readline library, but
>> IIRC it was a bit flaky and only worked in some of the console environments
>> (cmd, MSYS, cygwin, xterm).
> I noticed various references to rlwrap (readline wrapper) recently,
> so I decided to give it a try. There's a cygwin package for it:
> rlwrap runs the specified command, intercepting user input in order
> to supply
> readline's line editing, persistent history and completion. rlwrap tries
> to be as
> transparent as possible, keeping track of command's terminal settings,
> so that it
> can do the right thing when command asks for single keypresses or for a
> And it works like a charm!-) Not as specific as the GHCi-builtin
> support for completion, but better than just inheriting the command
> history scrolling and commandline editing from bash. Some helpful
> -c, --complete-filenames
> -H, --history-filename file
> -r, --remember
> Put all words seen on in- and output on the completion list.
> So, with
> $ rlwrap -c -H /cygdrive/c/Documents\ and\ Settings/cr3/Application\
> Data/ghc/rlwrap.log -r ghcii.sh
> I get filename completion, I get completion for language options
> that have been suggested in error messages (!-), and I don't have
> to spell things out twice, as the session history gets stored (btw,
> should there be ghc-version-specific Application\ Data/ghc/ dirs?).
> And all the general readline goodies, like incremental history search.
> There is probably some more fine-tuning possible, perhaps someone
> finds a way to give the rlwrap's readline on-the-fly access to the
> session-specific GHCi completion info designed for linked readline?
> Even if not, we could probably prep completion in 'rlwrap ghcii.sh'
> with the flag reference, and poor Windows users can get the
> comforts that non-Windows users are used to with GHCi!-)
> Anyway, I thought I'd share this early, before doing more
> Cvs-ghc mailing list
> Cvs-ghc at haskell.org
More information about the Cvs-ghc