GHC 9.4.2/Cabal 3.8.1.0 and PackageImports with reexported-modules - Problem
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I am having problems with GHC 9.4.2/`Cabal-3.8.1.0` and `PackageImports` with Cabal's `reexported-modules`. I think what I am experiencing is a bug - I apologise if it is 'by design'. To explain:
I have a library in package `my-package-B` which exposes module `LibB`. I have a library in package `my-package-A` which `build-depends` on `my-package-B` and has `reexported-modules` `LibB`.
Finally, I have an executable in package `my-package-C` which `build-depends` on `my-package-A` (only), and has `Main.hs`:
~~~haskell
{-# LANGUAGE PackageImports #-}
module Main (main) where
import "my-package-A" LibB (someFuncB)
main :: IO ()
main = print someFuncB
~~~
With `stack --resolver ghc-9.2.4 build`, it all builds as expected.
However, with `stack --resolver ghc-9.4.2 build`, and all else equal, the build fails with Cabal message:
~~~text
my-package-C> app\Main.hs:6:1: error:
my-package-C> Could not find module ‘LibB’
my-package-C> Perhaps you meant
my-package-C> LibB (from my-package-A-0.1.0.0, reexporting LibB)
my-package-C> LibA (from my-package-A-0.1.0.0)
my-package-C> |
my-package-C> 6 | import "my-package-A" LibB (someFuncB)
my-package-C> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
~~~
I can't make sense of the error message. I've requested `LibB` be imported from package `my-package-A` and I'm told it can't be found but perhaps I mean `LibB` reexported by `my-package-A`?
However, if I change (only) `Main.hs` to (no package-qualified import):
~~~
module Main (main) where
import LibB (someFuncB)
main :: IO ()
main = print someFuncB
~~~
`stack --resolver ghc-9.4.2 build` now works! That is why I think it is a bug.
Contributor guide
Assessment
This issue has not been assessed yet.