Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,407
    • Issues 5,407
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 600
    • Merge requests 600
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #18497
Closed
Open
Issue created Jul 25, 2020 by Robert Estelle@rwe

`-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 from 8.8.3 up through at least 8.12+ at fc0f6fbc.

Optional:

  • Operating System: macOS 10.15.6 (Catalina), though not OS-specific.
  • System Architecture: x86_64, though not arch-specific.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking