Integrating editline with ghc

Thorkil Naur naur at
Thu Jan 17 00:03:12 EST 2008


On Wednesday 16 January 2008 22:05, Judah Jacobson wrote:
> Hi all,
> I have managed to build ghc using the initial release of the editline 
> Hackage link:
> Haddock:
> As I've mentioned before, there are two independent modules:
> - System.Console.Editline is a very basic (and experimental) interface
> to the native editline APIs.
> - System.Console.Editline.Readline contains the readline APIs provided
> by the editline library (mostly a cut/paste of
> System.Console.Readline).


> Currently I'm using just the latter as a drop-in replacement for
> System.Console.Readline in ghci.  I have added a --with-editline flag
> to ghc's configure script, which has no effect if it's not specified,
> and otherwise does the following:
> - Throw an error (at configure time) if editline isn't present (as
> $hardtop/libraries/editline)

That's the way.

> - Use the editline package instead of readline when building ghc stage 2
> - Use CPP to make InteractiveUI.hs (the main ghci loop) import
> System.Console.Editline.Readline instead of System.Console.Readline.
> Does that sound like the right way to handle this?  If so, I'll send a
> darcs patch.

An alternative that would make the GHC configure script more symmetric with 
respect to command line editor would be to have --with-line-editor=editline, 
--with-line-editor=readline and also, perhaps, --with-line-editor=none (or 
even --with-line-editor=). All of these with, hopefully, obvious meanings. On 
top of this, one could have --with-edit-line=automatic with some automatic 
selection taking place. And the default? I'm sure that my favorite 
--with-line-editor=none will not be considered practical, so I will leave 
this most difficult choice to others.

> Also, should editline be made a boot-package or an extra-package (or 
> Thanks,
> -Judah
> ...

Thanks a lot again.

Best regards

More information about the Libraries mailing list