Is it possible to load bindings into ghci

Andreas Marth Andreas-Haskell at
Wed Aug 25 10:05:39 EDT 2004

I answer to 3 different mails here, so don' get confused:

Simon M. wrote:
>Like the '.' command in /bin/sh?  Yes, we ought to have something
>that.  I'll get around to it at some point, unless anyone gets there

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,

More information about the Glasgow-haskell-users mailing list