Integrating editline with ghc

Thorkil Naur naur at post11.tele.dk
Thu Jan 17 00:03:12 EST 2008


Hello,

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 
package:
> 
> Hackage link: 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/editline-0.1
> Haddock: http://code.haskell.org/editline/dist/doc/html/editline/
> 
> 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).

Excellent!

> 
> 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 
neither)?
> 
> Thanks,
> -Judah
> ...

Thanks a lot again.

Best regards
Thorkil


More information about the Libraries mailing list