darcs patch: [PROOF OF CONCEPT] build readline package with libedit

On Jan 8, 2008 5:39 AM, Simon Marlow
Ian Lynagh wrote:
Perhaps the best answer is for someone to make editline bindings for Haskell?
I don't *think* libedit provides the completion functionality that we use in GHC, but I could be wrong.
The only way to know for sure is to try it out! Attached is a proof-of-concept patch which adds the --with-libedit flag to the readline package's autoconf scripts. * PROOF OF CONCEPT: add --with-libedit flag to allow building a minimal version of the library against libedit. M ./HsReadline_cbits.c +2 M ./System/Console/Readline.hsc -1 +50 M ./aclocal.m4 +6 M ./configure.ac -4 +10 With this patch (and a small, unrelated hack to statically link gmp) I was able to build a version of ghc which only depends on the dynamic libraries installed on OS X 10.4 by default: $ otool -L ghc-6.9.20071221 ghc-6.9.20071221: /usr/lib/libedit.2.dylib (compatibility version 2.0.0, current version 2.0.0) /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.9) I played around with completion of filenames, modules, identifiers and flags in ghci, and it all seems to be working fine. Best, -Judah

Could you try to install http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-0.9.1 and http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-readline-... If that works, I'll be content with libedit as well. Christian Judah Jacobson wrote:
On Jan 8, 2008 5:39 AM, Simon Marlow
wrote: Ian Lynagh wrote:
Perhaps the best answer is for someone to make editline bindings for Haskell? I don't *think* libedit provides the completion functionality that we use in GHC, but I could be wrong.
The only way to know for sure is to try it out! Attached is a proof-of-concept patch which adds the --with-libedit flag to the readline package's autoconf scripts.
* PROOF OF CONCEPT: add --with-libedit flag to allow building a minimal version of the library against libedit.
M ./HsReadline_cbits.c +2 M ./System/Console/Readline.hsc -1 +50 M ./aclocal.m4 +6 M ./configure.ac -4 +10
With this patch (and a small, unrelated hack to statically link gmp) I was able to build a version of ghc which only depends on the dynamic libraries installed on OS X 10.4 by default:
$ otool -L ghc-6.9.20071221 ghc-6.9.20071221: /usr/lib/libedit.2.dylib (compatibility version 2.0.0, current version 2.0.0) /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.9)
I played around with completion of filenames, modules, identifiers and flags in ghci, and it all seems to be working fine.
Best, -Judah

On Jan 8, 2008 11:21 AM, Christian Maeder
Could you try to install http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-0.9.1 and http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-readline-...
If that works, I'll be content with libedit as well.
Christian
They don't work with the patch I sent before, but after adding back a few more functions supported by libedit, I was able to install both packages and successfully run a quick test of shellac-readline in ghci. (Although eventually, someone more familiar with that package may want to run more thorough tests.) I'll work on making a new patch which adds back all of the functionality that libedit supports (including what's needed for shellac-readline). -Judah

Good! By the way I've the following lines in my ~/.ghci from http://hackage.haskell.org/trac/ghc/ticket/998 :m +System.Console.Readline Data.List getCompleterWordBreakCharacters >>= setCompleterWordBreakCharacters . Data.List.delete '/' :m -System.Console.Readline Data.List Does this work with libedit, too? Christian Judah Jacobson wrote:
On Jan 8, 2008 11:21 AM, Christian Maeder
wrote: Could you try to install http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-0.9.1 and http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Shellac-readline-...
If that works, I'll be content with libedit as well.
Christian
They don't work with the patch I sent before, but after adding back a few more functions supported by libedit, I was able to install both packages and successfully run a quick test of shellac-readline in ghci. (Although eventually, someone more familiar with that package may want to run more thorough tests.)
I'll work on making a new patch which adds back all of the functionality that libedit supports (including what's needed for shellac-readline).
-Judah

On Jan 9, 2008 12:59 AM, Christian Maeder
By the way I've the following lines in my ~/.ghci from http://hackage.haskell.org/trac/ghc/ticket/998
:m +System.Console.Readline Data.List getCompleterWordBreakCharacters >>= setCompleterWordBreakCharacters . Data.List.delete '/' :m -System.Console.Readline Data.List
Does this work with libedit, too?
Christian
Hm... It runs, but doesn't have any effect. It looks like you need to use setBasicWordBreakCharacters instead of setCompleterWordBreakCharacters. (ghci sets both, which is why I didn't notice this before.) Note that with my fix to #998 (sent to cvs-ghc), that hack should no longer be necessary. -Judah

Judah, I completely agree that, at the least on the Mac, using editline is the best solution (as long all necessary functionality is supported). I am wondering, though, whether you are testing on Tiger or Leopard. When looking at the readline-emulation API of editline after upgrading to Leopard, I had the impression that it included much more functionality than it did on Tiger. Manuel
On Jan 9, 2008 12:59 AM, Christian Maeder
wrote: By the way I've the following lines in my ~/.ghci from http://hackage.haskell.org/trac/ghc/ticket/998
:m +System.Console.Readline Data.List getCompleterWordBreakCharacters >>= setCompleterWordBreakCharacters . Data.List.delete '/' :m -System.Console.Readline Data.List
Does this work with libedit, too?
Christian
Hm... It runs, but doesn't have any effect. It looks like you need to use setBasicWordBreakCharacters instead of setCompleterWordBreakCharacters. (ghci sets both, which is why I didn't notice this before.)
Note that with my fix to #998 (sent to cvs-ghc), that hack should no longer be necessary.
-Judah

Good point. Fortunately, I'm testing everything on Tiger (10.4.10),
so this shouldn't be a problem.
-Judah
On Jan 9, 2008 2:13 PM, Manuel M T Chakravarty
Judah,
I completely agree that, at the least on the Mac, using editline is the best solution (as long all necessary functionality is supported).
I am wondering, though, whether you are testing on Tiger or Leopard. When looking at the readline-emulation API of editline after upgrading to Leopard, I had the impression that it included much more functionality than it did on Tiger.
Manuel
On Jan 9, 2008 12:59 AM, Christian Maeder
wrote: By the way I've the following lines in my ~/.ghci from http://hackage.haskell.org/trac/ghc/ticket/998
:m +System.Console.Readline Data.List getCompleterWordBreakCharacters >>= setCompleterWordBreakCharacters . Data.List.delete '/' :m -System.Console.Readline Data.List
Does this work with libedit, too?
Christian
Hm... It runs, but doesn't have any effect. It looks like you need to use setBasicWordBreakCharacters instead of setCompleterWordBreakCharacters. (ghci sets both, which is why I didn't notice this before.)
Note that with my fix to #998 (sent to cvs-ghc), that hack should no longer be necessary.
-Judah

Judah Jacobson wrote:
I'll work on making a new patch which adds back all of the functionality that libedit supports (including what's needed for shellac-readline).
Let me again stress, that we should make all options work and let us or others decide later on, which option is best for them or which should be the default (taken by configure without arguments). Christian
participants (3)
-
Christian Maeder
-
Judah Jacobson
-
Manuel M T Chakravarty