Skip to content

How to work with auto generated Paths_xxx module? #443

@berberman

Description

@berberman

Subject of the issue

I'm trying to introduce data-files to my project. In order to access files in data-dir, an auto generated module Paths_xxx (xxx is the project name) is required to be imported to the module. However, it seems that hls can find this auto generated module at .stack-work/dist/.../.../.../build/autogen/Paths_xxx.hs, but doesn't know how to deal with that. So, I use multi cradle to let hls ignore .stack-work dir, but hls will complain that the module which uses getDataFileName will not be loaded because of this missing function, and those prevent a series of modules of the project won't be loaded as well.

Your environment

  • Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools
    • This command is available since version >= 0.4.0.0
haskell-language-server version: 0.4.0.0 (GHC: 8.10.2) (PATH: /usr/bin/haskell-language-server-8.10.2) (GIT hash: 0a18edde24923251a148cbbc0ae993a6aac83b9c)
Tool versions found on the $PATH
cabal:          3.2.0.0
stack:          2.3.1
ghc:            8.10.2
  • Which lsp-client do you use
    • Neovim, emacs, VS Codium, etc...

vscode

  • Describe your project (alternative: link to the project)

https://github.com/berberman/arch-hs

Steps to reproduce

Just open the project and load it.

Expected behaviour

hls knows what Paths_arch_hs is.

Actual behaviour

Module ‘Paths_arch_hs’ does not export ‘getDataFileName’

Actually, hls didn't load this module.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
(haskell-language-server)Ghcide setup tester in /home/berberman/Desktop/arch-hs.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Tool versions found on the $PATH
cabal:		3.2.0.0
stack:		2.3.1
ghc:		8.10.2


Step 1/4: Finding files to test in /home/berberman/Desktop/arch-hs
Found 23 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Utils.hs"
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-e1a0f5a15b1a5172633bf00dda6772d0895497c6
[INFO] Making new HscEnv[main]
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/submit/Submit.hs"
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-e721920226c057787f73c07ca140a8b0d7c87126
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-e721920226c057787f73c07ca140a8b0d7c87126
[INFO] Making new HscEnv[main,main]
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/Setup.hs"
File:     /home/berberman/Desktop/arch-hs/Setup.hs
Hidden:   no
Range:    1:0-2:0
Source:   cradle
Severity: DsError
Message: 
  �[0;91mMulti Cradle: No prefixes matched
  pwd: /home/berberman/Desktop/arch-hs
  filepath: /home/berberman/Desktop/arch-hs/Setup.hs
  prefixes:
  ("./app",Stack {component = Just "arch-hs:exe:arch-hs"})
  ("./diff",Stack {component = Just "arch-hs:exe:arch-hs-diff"})
  ("./submit",Stack {component = Just "arch-hs:exe:arch-hs-submit"})
  ("./src",Stack {component = Just "arch-hs:lib"})�[0m
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/diff/Diff.hs"
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-6c7ba429178a4583708cb933618cabb19b7c5d07
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-6c7ba429178a4583708cb933618cabb19b7c5d07
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-6c7ba429178a4583708cb933618cabb19b7c5d07
[INFO] Making new HscEnv[main,main,main]
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/Setup.hs"
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/app/Main.hs"
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-3eed09a1cc1ce8c9255decb48e008673712025ba
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-3eed09a1cc1ce8c9255decb48e008673712025ba
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-3eed09a1cc1ce8c9255decb48e008673712025ba
[INFO] Using interface files cache dir: /home/berberman/.cache/ghcide/main-3eed09a1cc1ce8c9255decb48e008673712025ba
[INFO] Making new HscEnv[main,main,main,main]
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/Setup.hs"
[INFO] Consulting the cradle for "/home/berberman/Desktop/arch-hs/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build/autogen/Paths_arch_hs.hs"
File:    
  /home/berberman/Desktop/arch-hs/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build/autogen/Paths_arch_hs.hs
Hidden:   no
Range:    1:0-2:0
Source:   cradle
Severity: DsError
Message: 
  �[0;91mMulti Cradle: No prefixes matched
  pwd: /home/berberman/Desktop/arch-hs
  filepath:
  /home/berberman/Desktop/arch-hs/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.0.0/build/autogen/Paths_arch_hs.hs
  prefixes:
  ("./app",Stack {component = Just "arch-hs:exe:arch-hs"})
  ("./diff",Stack {component = Just "arch-hs:exe:arch-hs-diff"})
  ("./submit",Stack {component = Just "arch-hs:exe:arch-hs-submit"})
  ("./src",Stack {component = Just "arch-hs:lib"})�[0m
[INFO] finish: User TypeCheck (took 0.89s)
Files that failed:
 * /home/berberman/Desktop/arch-hs/Setup.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Aur.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Community.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Core.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Exception.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Hackage.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Name.hs
 * /home/berberman/Desktop/arch-hs/src/Distribution/ArchHs/Internal/NameLoader.hs

Completed (15 files worked, 8 files failed)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions