`-ddump-minimal-imports` does not generate minimal `.hs-boot` imports
Summary
-ddump-minimal-imports
does not generate a separate .imports
file for .hs-boot
modules. This is unlike .hi-boot
, .hie-boot
, etc. and means that .hs-boot
modules are excluded from guidance on their minimal imports.
This is in spite of the fact that, when such boot modules exist, it is typically more important to restrict their dependencies than those of the corresponding main module.
This might be a feature request instead of a bug, though the documentation did not indicate that this was an intentional omission, and it caught me by surprise, so it might be an unintentional oversight.
Steps to reproduce
The following set of files describe a scenario with two mutually-dependent module definitions.
There's nothing special about it except that one of the .hs-boot
files needs to import something, and specifically needs to import a smaller/different set than its main module.
Foo.hs
module Foo where
import {-# SOURCE #-} Bar
data X = SomeX Y Y | NoX
foo :: X
foo = SomeX blah (woop NoX)
Foo.hs-boot
module Foo where
data X
foo :: X
Bar.hs
module Bar where
import Foo
data Y = SomeY X | NoY
blah :: Y
blah = NoY
blip :: Y
blip = SomeY foo
woop NoX = NoY
woop (SomeX y _) = y
Bar.hs-boot
module Bar where
import {-# SOURCE #-} Foo
data Y
blah :: Y
woop :: X -> Y
This command:
ghc -ddump-minimal-imports -fno-code Foo.hs Bar.hs
Generates:
Foo.imports
import {-# SOURCE #-} Bar ( Y, woop, blah )
Bar.imports
import Foo ( X(..), foo )
Expected behavior
Additional separate .imports-boot
files (named in the style as .hi-boot
, hie-boot
, etc) should be generated with the following contents:
Foo.imports-boot
(empty)
Bar.imports-boot
import {-# SOURCE #-} Foo (X)
Environment
- GHC version used: All versions supporting
-ddump-minimal-imports
, verified from8.8.3
up through at least8.12
+ at fc0f6fbc.
Optional:
- Operating System: macOS 10.15.6 (Catalina), though not OS-specific.
- System Architecture: x86_64, though not arch-specific.