[Haskell-cafe] Why isn't hsc2hs functionality provided by ghc?

Tillmann Rendel rendel at informatik.uni-marburg.de
Wed Jun 5 13:41:30 CEST 2013


Hi,

Roman Cheplyaka wrote:
>>> My preferred solution would be to have ghc/ghci automatically run hsc2hs
>>> [...] when necessary.
>>
>> How about having a `ghci` command for cabal?
>
> I don't think cabal can provide that. Let's say you're inside a 'cabal
> ghci' session. If you modify the hsc file and reload it in ghci, you'd
> expect to load the updated version — yet cabal hasn't even been called
> since 'cabal ghci', and have had no chance to re-generate the hs file.

Maybe ghci could be changed to call some kind of hook everytime a file 
is called, and cabal could then provide an implementation for this hook 
that regenerates the files if necessary?

Maybe this is even possible today using:

   :def r somethingCleverHere

A quick test shows some minor problems, like

   :def r (const (return ":r"))
   :r

looping. But maybe this could be figured out.

   Tillmann



More information about the Haskell-Cafe mailing list