Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cabal file not found for when hs-source-dirs = "." #909

Closed
brandonchinn178 opened this issue Jul 14, 2022 · 0 comments · Fixed by #912
Closed

Cabal file not found for when hs-source-dirs = "." #909

brandonchinn178 opened this issue Jul 14, 2022 · 0 comments · Fixed by #912
Labels
bug Something isn't working

Comments

@brandonchinn178
Copy link
Collaborator

Describe the bug
When I set hs-source-dirs: . in the cabal file, modules don't find the cabal file correctly, specifically:

Found .cabal file a/b/foo.cabal, but it did not mention a/b/Foo/Bar.hs

To Reproduce

-- a/b/foo.cabal
library
  exposed-modules:
    Foo.Bar
  hs-source-dirs: .
  default-extensions: ImportQualifiedPost
-- a/b/Foo/Bar.hs
module Foo.Bar where
import Data.List qualified as List

Expected behavior
Should find the appropriate cabal file

Environment

  • OS name + version:
  • Version of the code:

Additional context
Problem seems to be here:

(takeDirectory cabalFile </>) <$> prependSrcDirs (dropExtensions m)
where
prependSrcDirs f
| null hsSourceDirs = [f]
| otherwise = (</> f) . getSymbolicPath <$> hsSourceDirs

Where the final path should be normalized:

>>> "foo" </> "." </> "A.hs"
"foo/./A.hs
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants