[GHC] #9256: Support automatic derivation of an hs-boot file from an hs file

GHC ghc-devs at haskell.org
Tue Jul 1 12:08:14 UTC 2014


#9256: Support automatic derivation of an hs-boot file from an hs file
-------------------------------------+------------------------------------
        Reporter:  ezyang            |            Owner:  ezyang
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:  backpack
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by ezyang):

 Replying to [comment:3 goldfire]:
 > Where is augustss's proposal in #1409? There's ''lots'' of text there.

 I quoted his comment, but it's this one:
 https://ghc.haskell.org/trac/ghc/ticket/1409#comment:13

 > What is a "mutual recursion breaker"? Is it something that ''does''
 appear in the hi-boot file? Or is it something that ''does not'' appear in
 the hi-boot file? (Sounds like the latter.)

 Yep, the latter.

 > Are you proposing that every module, even in the absence of pragmas, now
 produce both a hi and a hi-boot file?

 Hm, that's probably bad. It should only generate an hi-boot file if there
 is some pragma.

 > Your proposal suggests that every top-level definition will now need a
 type signature, but I don't imagine you mean that. Is this only when some
 pragma is specified?

 Yep.

 > Then, not quite understanding what breakers are, my understanding goes
 downhill from there.
 >
 > In your summary, is there something that distinguishes a "hs to hs-boot
 file" from a normal hs file?
 >
 > Sorry -- this is interesting to me, but I'm a little lost here. Thanks!

 So let's be a bit more concrete about the use case.

 1. You're writing a pair of modules A and B, and you realize that you want
 some mutual recursion.

 2. In the old world order, you'd pick one module to be loop-breaker (say
 A), create a boot file (A.hs-boot), and modify B's import to be a SOURCE
 import.

 3. In the new world order, you instead add a pragma to A.hs which
 specifies which identifies would have been placed in the A.hs-boot file. B
 still receives a SOURCE import as before.

 4. Now, when performing `--make` compilation, we notice that A.hs has a
 pragma, so we pretend as if an hs-boot file existed, and first compile
 A.hs as a boot file, then compiling B.hs and then A.hs normally.

 I haven't worked out how to adjust one-shot compilation to work with this.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9256#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list