Skip to content

cabal cannot find Main #304

Closed
Closed
@HE7086

Description

@HE7086

I am getting this error on Main.hs, while other files worked fine
cabal can build the executable and it runs fine.
this only occurs with hls but not hie (previously, like several months ago)

Screenshot_20200810_003143

a toy project can be found here
(note that -dynamic flag maybe not required on other distributions)

env:
arch linux
neovim with coc
ghc 8.10.1, cabal 3.2.0.0, all dynamically linked
hls 0.2.2 from AUR

:CocInfo output:

## versions

vim version: NVIM v0.4.4
node version: v14.7.0
coc.nvim version: 0.0.78-bdd9a9e140
coc.nvim directory: /home/he/.config/nvim/plugged/coc.nvim
term: xterm-256color
platform: linux

## Output channel: languageserver.haskell

Module "/home/he/code/Fourier/src/a" is loaded by Cradle: 
Cradle {cradleRootDir = "/home/he/code/Fourier", cradleOptsProg = CradleAction: Cabal}
Run entered for haskell-language-server-wrapper
(haskell-language-server-wrapper) Version 0.2.2.0, 
Git revision e44f618c11b7978264a94beeee00d1f014867f6d (dirty) x86_64 ghc-8.10.1
Current directory: /home/he/code/Fourier/src
Operating system: linux
Arguments: ["--lsp"]
Cradle directory: /home/he/code/Fourier
Cradle type: Cabal
Consulting the cradle to get project GHC version...
Project GHC version: 8.10.1
haskell-language-server exe candidates: 
["haskell-language-server-8.10.1","haskell-language-server-8.10","haskell-language-server"]
Launching haskell-language-server exe at:/usr/bin/haskell-language-server-8.10.1
haskell-language-server version: 0.2.2.0 (GHC: 8.10.1) 
(PATH: /usr/bin/haskell-language-server-8.10.1) 
(GIT hash: e44f618c11b7978264a94beeee00d1f014867f6d)
Starting (haskell-language-server)LSP server... 
with arguments: LspArguments 
{
    argLSP = True, 
    argsCwd = Nothing, 
    argFiles = [], 
    argsShakeProfiling = Nothing, 
    argsTesting = False, 
    argsExamplePlugin = False, 
    argsDebugOn = False, 
    argsLogFile = Nothing, 
    argsThreads = 0, 
    argsProjectGhcVersion = False
}
with plugins: 
[
    PluginId "eval",
    PluginId "floskell",
    PluginId "ghcide",
    PluginId "ormolu",
    PluginId "pragmas",
    PluginId "stylish-haskell"
]
  in directory: /home/he/code/Fourier
If you are seeing this in a terminal, 
you probably should have run ghcide WITHOUT the --lsp option!
 
Started LSP server in 0.00s
2020-08-10 00:23:33.229718237 [ThreadId 17] - Opened text document: file:///home/he/code/Fourier/src/Main.hs
Data.HashMap.Base.(!): key not found
CallStack (from HasCallStack):
  error, called at ./Data/HashMap/Base.hs:733:16 in unordered-containers-0.2.11.0-0b1b8f67eff94409f2a679203f1f70f269da36a64c96a4b431ee329c4593e137:Data.HashMap.Base!, 
  called at src/Development/IDE/Import/DependencyInformation.hs:107:40 in ghcide-0.2.0-inplace:Development.IDE.Import.DependencyInformation
2020-08-10 00:23:33.230548342 [ThreadId 51] - Consulting the cradle for "/home/he/code/Fourier/src/Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/home/he/code/Fourier", cradleOptsProg = CradleAction: Cabal}
> cabal: Unknown target '/home/he/code/Fourier/src/Main.hs'.
> The package Fourier has no file target 'src/Main.hs'.
> 
> 
2020-08-10 00:23:35.234646606 [ThreadId 64] - Plugin.makeCodeLens (ideLogger)
2020-08-10 00:23:35.235621515 [ThreadId 35] - finish: codeLens (took 0.00s)

## Output channel: highlight

[Info  - 12:23:33 AM] Highlight server running in node v14.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions