Skip to content

Only considers imports with real source spans#8

Open
jlavelle wants to merge 3 commits intomainfrom
nebula/backpack-support
Open

Only considers imports with real source spans#8
jlavelle wants to merge 3 commits intomainfrom
nebula/backpack-support

Conversation

@jlavelle
Copy link
Copy Markdown
Member

@jlavelle jlavelle commented Apr 6, 2026

GHC (and possibly other plugins) can inject synthetic imports for e.g. Backpack signatures that a module transitively depends on. Before this change, it was not possible to write a qualification rule for a signature in some circumstances, e.g. when a module that imports a signature directly is imported in a module that doesn't directly import the signature.

I created a minimal reproducer of the specific issue I ran into: https://github.com/jlavelle/henforcer-backpack-reproducer. It will fail on main, and succeed on the with-fix branch (which points at this commit).

jlavelle added 2 commits April 6, 2026 17:09
GHC (and possibly other plugins) can inject synthetic imports for e.g.
Backpack signatures that a module transitively depends on. Before this
change, it was not possible to write a qualification rule for a
signature in some circumstances, e.g. when a module that imports a
signature directly is imported in a module that doesn't direclty import
the signature.
GHC wants a type signature for it otherwise because we use
-Wmonomorphism-restriction. Simpler to inline.
@jlavelle
Copy link
Copy Markdown
Member Author

jlavelle commented Apr 6, 2026

For posterity @telser and I had a conversation out-of-band about whether this would affect implicit Prelude imports (custom or otherwise) in some way and the answer is no, they do not get filtered by this function because GHC assigns them a span (line 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant