[GHC] #14809: Invocation of ghc with --make flag should be smarter about hs-boot and lhs-boot files

GHC ghc-devs at haskell.org
Wed Feb 14 05:52:52 UTC 2018


#14809: Invocation of ghc with --make flag should be smarter about hs-boot and lhs-
boot files
-------------------------------------+-------------------------------------
           Reporter:  mrkkrp         |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Currently, `--make` in handy for compiling programs with boot files using
 only one `ghc` invocation. But it behaves strange.

 If I pass `A.hs`, `B.hs`, and `A.hs-boot` (where `B.hs` imports module `A`
 with that `{-# SOURCE -#}` thing), I get an error message complaining
 about module `A` defined twice. Surely GHC should be able to figure out
 that if the second file has the extension `hs-boot`, it's a boot file and
 should be used as such.

 After all, GHC is perfectly capable of finding boot files if it's given
 import directories to search in (with `-i`). We can't however easily use
 that because it so happens that if we tell ghc about such directories,
 they can contain files that should not be visible. I even tried a
 workaround: copy all boot files to a separate location and then point to
 that location with `-i`. To my surprise in that case ghc does not pick up
 those boot files. (And with more complex nesting of modules I expect more
 problems with this approach.)

 So it would be great if we could just feed all the relevant files into ghc
 and it would be smart enough not to complain about modules defined twice
 if one of the modules is in a file with `hs-boot` or `lhs-boot` extension,
 but use it as a boot file for corresponding module.

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


More information about the ghc-tickets mailing list