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@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to