RE: Is it possible to load bindings into ghci

On 24 August 2004 12:47, Andreas Marth wrote:
At the moment it happens that I use an unfinished program with ghci. And each time I start GHCi, I have to introduce the same bindings aka 'cont <- readFile "myFile"' ... Is there a way to define them once in a File and then point GHCi to it? (I need somme of the functions in the unfinished program so it has to be after reading the program file.)
Like the '.' command in /bin/sh? Yes, we ought to have something like that. I'll get around to it at some point, unless anyone gets there first. Cheers, Simon

On Wed, Aug 25, 2004 at 09:09:40AM +0100, Simon Marlow wrote:
On 24 August 2004 12:47, Andreas Marth wrote:
At the moment it happens that I use an unfinished program with ghci. And each time I start GHCi, I have to introduce the same bindings aka 'cont <- readFile "myFile"' ... Is there a way to define them once in a File and then point GHCi to it? (I need somme of the functions in the unfinished program so it has to be after reading the program file.)
Like the '.' command in /bin/sh? Yes, we ought to have something like that. I'll get around to it at some point, unless anyone gets there first.
Dirty hack - you can put such bindings in ~/.ghci :) Best regards, Tom -- .signature: Too many levels of symbolic links

On Wed, Aug 25, 2004 at 09:09:40AM +0100, Simon Marlow wrote:
On 24 August 2004 12:47, Andreas Marth wrote:
At the moment it happens that I use an unfinished program with ghci. And each time I start GHCi, I have to introduce the same bindings aka 'cont <- readFile "myFile"' ... Is there a way to define them once in a File and then point GHCi to it? (I need somme of the functions in the unfinished program so it has to be after reading the program file.)
Like the '.' command in /bin/sh? Yes, we ought to have something like that. I'll get around to it at some point, unless anyone gets there first.
How about this: :def . readFile :. C.hs I guess I got there first ;) Best regards, Tom -- .signature: Too many levels of symbolic links

Like the '.' command in /bin/sh? Yes, we ought to have something
I answer to 3 different mails here, so don' get confused: Simon M. wrote: like
that. I'll get around to it at some point, unless anyone gets there first.
I don't know about the '.' command in /bin/sh and I don't have a *nix machine at hand to find out. It's a pity. Tomasz Z. wrote:
Dirty hack - you can put such bindings in ~/.ghci :)
I tried that before posting the mail, but it does not work because the .ghci is read before going to the submitted file which contains the functions I need. (And ghci discards the bindings.) (I can read the contents of a file. Even print it, manipulate it (but only with what is supplied with package base). Quit good already!) Later Tomasz Z.
How about this:
:def . readFile :. C.hs
I guess I got there first ;)
That works great! And you can even put the ":def . readFile" in the .ghci File! So now I start ghci with "ghci MyFile" wait until it's finished and do ":. all_the_stuff_I_need_in_a_file" and every thing is fine! Thaks a lot, Andreas

On Wed, Aug 25, 2004 at 04:05:39PM +0200, Andreas Marth wrote:
Tomasz Z. wrote:
Dirty hack - you can put such bindings in ~/.ghci :)
I tried that before posting the mail, but it does not work because the .ghci is read before going to the submitted file which contains the functions I need. (And ghci discards the bindings.) (I can read the contents of a file. Even print it, manipulate it (but only with what is supplied with package base). Quit good already!)
You could :load your modules in .ghci, but that would be inconvenient.
That works great! And you can even put the ":def . readFile" in the .ghci File!
Thaks a lot, Andreas
Thanks to you too. I wanted such functionality many times before, but it was after your question that I actually tried to do this :) Best regards, Tom -- .signature: Too many levels of symbolic links
participants (3)
-
Andreas Marth
-
Simon Marlow
-
Tomasz Zielonka