GHCi hacking

Neil Mitchell ndmitchell at gmail.com
Fri Aug 18 05:54:21 EDT 2006


Hi,

Have you seen:

Shellac: http://www.eecs.tufts.edu/~rdocki01/shellac.html
There was one with the JHC stuff which I'm sure i've seen
hs-plugins: http://www.cse.unsw.edu.au/~dons/hs-plugins/

If what you want is a shell like thing, Shellac will give it to you.
If you want to evaluate arbitrary Haskell then hs-plugins will give it
to you. If you want both, combine them.

Probably much easier than hacking at GHCi!

Thanks

Neil


On 8/18/06, Ulf Norell <ulfn at cs.chalmers.se> wrote:
> Hi.
>
> I want to use GHCi as the interface to my Application. The simple
> solution is to have the Application store its state in global IORefs.
> A user can then start up ghci with -package Application and use the
> provided functions to communicate with the Application. This works
> nicely.
>
> Now the tricky part. I want the user to be able to implement her own
> layers on top of the Application API. A typical user interaction
> could look something like this:
>
> $ ghci -package Application
> *Application:API> startApplication
> *Application:API> :load UserLayer
> *main:UserLayer> myCleverFunction 42
>
> The problem, of course, is that as soon as the user says ':load' ghci
> forgets all about the state of the Application. My solution to the
> problem is to compile my own version of ghci (copy InteractiveUI.hs
> and use -package ghc) and remove the call to rts_revertCAFs when
> loading new modules. This seems to work, but since I don't really
> have a clue what I'm doing I wanted to ask a few questions:
>
> 1) What is a CAF?
> 2) What breaks down if you don't revert them?
> 3) Does not reverting the CAFs really solve my problem?
>
> / Ulf
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>


More information about the Glasgow-haskell-users mailing list