darcs patch: XPrompt: a module for easily writing gr... (and 3 more)

Hi,
there we are. It is not finished but can you can get the taste of what I'm
trying to do.
I'll send a longer description as a replay to this mail.
Andrea
Thu Aug 2 17:58:19 CEST 2007 Andrea Rossato

On Thu, Aug 02, 2007 at 06:03:51PM +0200, Andrea Rossato wrote:
Hi,
Hi, as I said is not finished yet: the completion is not working properly. Completions show up, but by pressing Tab the first one will be selected and... well give it a try. A description: basically it is a library for writing prompts. You need to use mkXPrompt with the configuration (a default one is provided), a prompt type, for which you have to declare a type and make it an instance of the XPrompt class, by defining a showXPrompt method (will be used to print the prompt). The completion function is just a String -> IO [String] function. You can used the ones provided by the readline bindings (such as in ShellPrompt) or you can write your own. You can also use mkComplFunFromList: just feed it with a list of possible completion. Have alook at XMonadPrompt or SshPrompt to see how. Completions: the prompt will try to complete each word with the same completion function. This could be changed: giving a list of function, a map so that the function can be chosen with regard to the previous word... I don't know. If that is really going to be needed I can study the problem. History: no history so far, but there will be history support real soon: we need to write the history to a file, though. TODO: finish the completion stuff add history support, clean the code (see below). Aesthetics: the code is quite ugly I know. Actually I thought it was going to be easier to write a prompt. It is not, after all. As you see I'm simple minded: just a huge StateT. At first I was puzzled (actually I still am): I did not know whether I should write a stand alone application or not. The ugly style is also due to the fact that till now I did not take a decision. probably the code could be broken down to smaller pieces, providing useful modules for other kind of stuff. But I don't know, if this is useful after all. Just a final word, dedicated to Tuomo, who is not very popular among the free and open source software communities, lately. It was thank to Tuomo that I discovered Haskell. At first I was exposed to darcs, which Tuomo used for developing Ion, but I didn't care that much, since usable darcs binaries can be easily found. Later I discovered Riot and I felt intrigued by that language: I could almost understand where the code was headed, but I just couldn't read it. It was a real challenge and I took it seriously: first the SICP classes with a ghci prompt under my fingers and then at least a couple of tutorials... I needed to write to understand...;-) And so, after a month and a half of deep study I started hacking the ContactManager that comes as an example of hscurses usage. It's there, I think, that I pick up this ugly style ...;-) And now, a year after, I'm here writing for myself a Ion substitution. Thanks to Tuomo, once again. Have fun. Andrea

On Thu, Aug 02, 2007 at 06:03:51PM +0200, Andrea Rossato wrote:
Hi,
A last important word: do not use this stuff on a production machine. XMonad is going to crash real soon due to bugs in the completion stuff. You may want to use it just to see what I'm trying to achieve, to send suggestion or comments. I'll soon send an updated patch, possibly a working one. ciao Andrea

On Thu, Aug 02, 2007 at 06:45:21PM +0200, Andrea Rossato wrote:
On Thu, Aug 02, 2007 at 06:03:51PM +0200, Andrea Rossato wrote:
Hi,
A last important word: do not use this stuff on a production machine. XMonad is going to crash real soon due to bugs in the completion stuff.
I tried to send a fixed version (that didn't crash so far, here at least), but I seem to have problem sending mails (actually I'm writing this message also to test if the problem is on my side). Once again, sorry for all this noise. Andrea

On Thu, Aug 02, 2007 at 07:47:34PM +0200, Andrea Rossato wrote:
On Thu, Aug 02, 2007 at 06:45:21PM +0200, Andrea Rossato wrote:
On Thu, Aug 02, 2007 at 06:03:51PM +0200, Andrea Rossato wrote:
Hi,
A last important word: do not use this stuff on a production machine. XMonad is going to crash real soon due to bugs in the completion stuff.
I tried to send a fixed version (that didn't crash so far, here at least), but I seem to have problem sending mails (actually I'm writing this message also to test if the problem is on my side).
Your message was received. Stefan

On Thu, Aug 02, 2007 at 10:54:39AM -0700, Stefan O'Rear wrote:
Your message was received.
yes, thanks. still I'm not able to send patches from darcs (and darcs uses the same sendmail mutt is using). I'm sending the patch manually. Thanks and sorry for the noise. Andrea

On Thu, Aug 02, 2007 at 08:01:43PM +0200, Andrea Rossato wrote:
On Thu, Aug 02, 2007 at 10:54:39AM -0700, Stefan O'Rear wrote:
Your message was received.
yes, thanks. still I'm not able to send patches from darcs (and darcs uses the same sendmail mutt is using).
I'm sending the patch manually.
ok, at least now I know that the problem is not on my side: file with an attachment are not getting through, but my sendmail is regularly sending them. I'll try to sort this out. BTW, the patch can be downloaded here, if you are interested: http://gorgias.mine.nu/xprompt.patch I'll try to resend it tomorrow. Hopefully the completion stuff will be finished. Hopefully. all the best andrea
participants (2)
-
Andrea Rossato
-
Stefan O'Rear