Re: [Haskell] ANN: ghci-haskeline 0.1

On Mon, Jan 12, 2009 at 12:57:57PM -0800, Judah Jacobson wrote:
I'm pleased to announce the first release of ghci-haskeline. This package uses the GHC API to reimplement ghci with the Haskeline library as a backend. Haskeline is a library for line input in command-line programs, similar to readline or editline, which is written in Haskell and thus (hopefully) more easily integrated into other Haskell programs.
Perhaps this has already been discussed at length, in which case I apologize but, well, why provide line input editing at all? A number of languages/programs (off the top of my head: sml, most Schemes) don't; the standard method to get line editing is rlwrap. And this works (in my limited experience) quite well. The disadvantage as I see it of using editline or Haskeline or whatever is that it's going to be sutbly different than other methods; presumably, people won't like the changes in behavior. It seems to me that from a UNIX-y separation of concern view, the right thing to do (as many languages have chosen) is to /not/ provide line editing, and just let the user do that with any number of convenient tools that focus on getting/that/ right (like rlwrap.) Is there a reason we've not taken that approach? Thanks, AHH

Haskeline is designed to remove the readline dependency, because Windows does not have readline. So rlwrap is useless there. Andrew Hunter wrote:
On Mon, Jan 12, 2009 at 12:57:57PM -0800, Judah Jacobson wrote:
I'm pleased to announce the first release of ghci-haskeline. This package uses the GHC API to reimplement ghci with the Haskeline library as a backend. Haskeline is a library for line input in command-line programs, similar to readline or editline, which is written in Haskell and thus (hopefully) more easily integrated into other Haskell programs.
Perhaps this has already been discussed at length, in which case I apologize but, well, why provide line input editing at all?
A number of languages/programs (off the top of my head: sml, most Schemes) don't; the standard method to get line editing is rlwrap. And this works (in my limited experience) quite well. The disadvantage as I see it of using editline or Haskeline or whatever is that it's going to be sutbly different than other methods; presumably, people won't like the changes in behavior.
It seems to me that from a UNIX-y separation of concern view, the right thing to do (as many languages have chosen) is to /not/ provide line editing, and just let the user do that with any number of convenient tools that focus on getting/that/ right (like rlwrap.) Is there a reason we've not taken that approach?
Thanks, AHH

On Mon, Jan 12, 2009 at 10:11:19PM +0000, ChrisK wrote:
Haskeline is designed to remove the readline dependency, because Windows does not have readline. So rlwrap is useless there.
Ah, I hadn't considered Windows support--that makes sense. Thanks, that answers my questions. AHH

Haskeline is designed to remove the readline dependency, because Windows does not have readline. So rlwrap is useless there.
Ah, I hadn't considered Windows support--that makes sense. Thanks, that answers my questions.
AHH
One nice thing would be to write something like rlwrap that would work everywhere Haskell does. Even more sofisticated behavior could come from some comunication from the api, using standard OS facilities (like a file with an updated list of completions, or something more clever). (For those interested: rlwrap is available in cygwin. It used to work very well on old ghci, when line editing wasn't available.) Best, MaurĂcio

On Tue, Jan 13, 2009 at 6:03 AM, Mauricio
Haskeline is designed to remove the readline dependency, because Windows does not have readline. So rlwrap is useless there.
Ah, I hadn't considered Windows support--that makes sense. Thanks, that answers my questions.
AHH
One nice thing would be to write something like rlwrap that would work everywhere Haskell does. Even more sofisticated behavior could come from some comunication from the api, using standard OS facilities (like a file with an updated list of completions, or something more clever).
(For those interested: rlwrap is available in cygwin. It used to work very well on old ghci, when line editing wasn't available.)
This does sound useful; the main difficulty is that when a program has stdin piped from another process it may behaved differently. For example, ghci uses block buffering and doesn't print its prompt when stdin doesn't appear to be a terminal. The solution on POSIX is probably to use some sort of pseudo-terminal support; I don't know what the right thing to do on Windows is. The following post discusses those issues in a little more detail: http://www.haskell.org/pipermail/haskell-cafe/2008-May/042342.html -Judah

Judah Jacobson ha scritto:
[...]
(For those interested: rlwrap is available in cygwin. It used to work very well on old ghci, when line editing wasn't available.)
This does sound useful; the main difficulty is that when a program has stdin piped from another process it may behaved differently. For example, ghci uses block buffering and doesn't print its prompt when stdin doesn't appear to be a terminal. The solution on POSIX is probably to use some sort of pseudo-terminal support; I don't know what the right thing to do on Windows is.
On Windows you can create a Console object: http://msdn.microsoft.com/en-us/library/ms682087.aspx Regards Manlio Perillo

* Andrew Hunter
On Mon, Jan 12, 2009 at 12:57:57PM -0800, Judah Jacobson wrote:
I'm pleased to announce the first release of ghci-haskeline. This package uses the GHC API to reimplement ghci with the Haskeline library as a backend. Haskeline is a library for line input in command-line programs, similar to readline or editline, which is written in Haskell and thus (hopefully) more easily integrated into other Haskell programs.
Perhaps this has already been discussed at length, in which case I apologize but, well, why provide line input editing at all?
A number of languages/programs (off the top of my head: sml, most Schemes) don't; the standard method to get line editing is rlwrap. And this works (in my limited experience) quite well. The disadvantage as I see it of using editline or Haskeline or whatever is that it's going to be sutbly different than other methods; presumably, people won't like the changes in behavior.
It seems to me that from a UNIX-y separation of concern view, the right thing to do (as many languages have chosen) is to /not/ provide line editing, and just let the user do that with any number of convenient tools that focus on getting/that/ right (like rlwrap.) Is there a reason we've not taken that approach?
For example, ghci does more intelligent completion than rlwrap probably can do: X<tab> -> no matches :m X<tab> -> XMonad -- Roman I. Cheplyaka :: http://ro-che.info/ "Don't let school get in the way of your education." - Mark Twain
participants (6)
-
Andrew Hunter
-
ChrisK
-
Judah Jacobson
-
Manlio Perillo
-
Mauricio
-
Roman Cheplyaka