
On 30/04/2008, at 0:19, Ian Lynagh wrote:
On Mon, Apr 14, 2008 at 01:22:42PM +0200, pepe wrote:
Another question is where in the package hierarchy would this function live. Since the code it would use is in the ghc package, it would introduce a dependency on it. And I am fairly sure that there is no package in the standard ghc distribution which depends on the ghc package. Ian, can it be made to live in ghc-prim without creating a dependency on the ghc package?
I'm not sure I understand the question. If it needs to use functions in the ghc package then it needs to be in a package that depends on the ghc package, but ghc depends on ghc-prim, so it can't be in there.
Scrap that, I figured out a better way to do it. It's an old hack that lemmih used for the early breakpoint primitive. The trick consists in replacing the unsafeShow function for an unlinked actualUnsafeShow identifier in the renamer. Then, we dinamically link the real :print functionality to this identifier, when setting the context in GHCi. With the appropriate type declarations preloaded in the local environment GHC can be convinced to work finely in this way, of course only for interpreted code. pepe