Skip to content

[partial function] Map.!: given key is not an element in the map #3002

Closed
@kokobd

Description

@kokobd

Your environment

Which OS do you use: NixOS

Which LSP client (editor/plugin) do you use: VSCode Haskell

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

Use my fork, but comment out the following section in flake.nix, like this:

                # modules = [{
                #   reinstallableLibGhc = false;
                #   nonReinstallablePkgs = [
                #     "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base" "deepseq" "array" "ghc-boot-th"
                #     "pretty" "template-haskell" "ghcjs-prim" "ghcjs-th" "ghc-bignum" "exceptions" "stm" "ghc-boot"
                #     "ghc" "Cabal" "Win32" "array" "binary" "bytestring" "containers" "directory" "filepath" "ghc-boot"
                #     "ghc-compact" "ghc-prim" "hpc" "mtl" "parsec" "process" "text" "time" "transformers" "unix" "xhtml"
                #     "terminfo"
                #   ];
                # }];

With the modules config, hls works. Without it, hls fails with Map.!: given key is not an element in the map

Steps to reproduce

  1. run nix build to generate a hls executable at result/bin/haskell-language-server
  2. enter a develop shell with nix develop
  3. run result/bin/haskell-language-server to see it fail
  4. (optional) you can point vscode to result/bin/haskell-language-server and use nix environment selector.

Expected behaviour

HLS should work normally

Actual behaviour

Every file reports this error on the first line.

Map.!: given key is not an element in the map
CallStack (from HasCallStack):
  error, called at src/Data/Map/Internal.hs:633:17 in containers-0.6.5.1-1mJ1aiYFxjS4zGVm0SPbaq:Data.Map.Internal

Include debug information

log
Finished: QualifyImportedNames.TypeCheck Took: 0.00s
Finished: changeTypeSignature.GetParsedModule Took: 0.00s
Finished: alternateNumberFormat.CollectLiterals Took: 0.00s
Finished: Hlint.GetModSummary Took: 0.00s
Finished: Pragmas.GhcSession Took: 0.00s
Finished: RefineImports Took: 0.00s
Finished: Pragmas.GetFileContents Took: 0.00s
Finished: GADT.GetParsedModuleWithComments Took: 0.00s
Finished: Pragmas.GetParsedModule Took: 0.00s
Finished: GhcideCodeActions.getParsedModule Took: 0.00s
2022-06-30T02:46:03.130105Z | Debug | Finished: RefineImports Took: 0.00s
2022-06-30T02:46:03.130229Z | Debug | Finished: QualifyImportedNames.TypeCheck Took: 0.00s
2022-06-30T02:46:03.130231Z | Debug | Finished: changeTypeSignature.GetParsedModule Took: 0.00s
2022-06-30T02:46:03.130253Z | Debug | Finished: importLens Took: 0.00s
2022-06-30T02:46:03.130253Z | Debug | Finished: Pragmas.GhcSession Took: 0.00s
2022-06-30T02:46:03.130330Z | Debug | Finished: GhcideCodeActions.GhcSession Took: 0.00s
2022-06-30T02:46:03.130362Z | Debug | Finished: GhcideCodeActions.GhcSession Took: 0.00s
2022-06-30T02:46:03.130374Z | Debug | Finished: GADT.GetParsedModuleWithComments Took: 0.00s
2022-06-30T02:46:03.130375Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2022-06-30T02:46:03.130395Z | Debug | Finished: Hlint.GetFileContents Took: 0.00s
2022-06-30T02:46:03.130406Z | Debug | Finished: alternateNumberFormat.CollectLiterals Took: 0.00s
2022-06-30T02:46:03.130434Z | Debug | Finished: Hlint.GetModSummary Took: 0.00s
2022-06-30T02:46:03.130441Z | Debug | Finished: Pragmas.GetFileContents Took: 0.00s
2022-06-30T02:46:03.130441Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2022-06-30T02:46:03.130448Z | Debug | Finished: GhcideCodeActions.GetGlobalBindingTypeSigs Took: 0.00s
2022-06-30T02:46:03.130460Z | Debug | Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
2022-06-30T02:46:03.130467Z | Debug | Finished: Pragmas.GetParsedModule Took: 0.00s
2022-06-30T02:46:03.130501Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2022-06-30T02:46:03.130506Z | Debug | Finished: GhcideCodeActions.TypeCheck Took: 0.00s
2022-06-30T02:46:03.130508Z | Debug | Finished: GhcideCodeActions.getIdeOptions Took: 0.00s
2022-06-30T02:46:03.130526Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2022-06-30T02:46:03.130571Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2022-06-30T02:46:03.130578Z | Debug | Finished: GhcideCodeActions.GetBindings Took: 0.00s
2022-06-30T02:46:03.130651Z | Debug | Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
2022-06-30T02:46:03.130669Z | Debug | Finished: GhcideCodeActions.GetFileContents Took: 0.00s
2022-06-30T02:46:03.130697Z | Debug | Finished: GhcideCodeActions.getParsedModule Took: 0.00s
Finished: RefineImports Took: 0.00s
Finished: QualifyImportedNames.TypeCheck Took: 0.00s
Finished: changeTypeSignature.GetParsedModule Took: 0.00s
Finished: importLens Took: 0.00s
Finished: Pragmas.GhcSession Took: 0.00s
Finished: GhcideCodeActions.GhcSession Took: 0.00s
Finished: GhcideCodeActions.GhcSession Took: 0.00s
Finished: GADT.GetParsedModuleWithComments Took: 0.00s
Finished: GhcideCodeActions.GetFileContents Took: 0.00s
Finished: Hlint.GetFileContents Took: 0.00s
Finished: alternateNumberFormat.CollectLiterals Took: 0.00s
Finished: Hlint.GetModSummary Took: 0.00s
Finished: Pragmas.GetFileContents Took: 0.00s
Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
Finished: GhcideCodeActions.GetGlobalBindingTypeSigs Took: 0.00s
Finished: GhcideCodeActions.GetAnnotatedParsedSource Took: 0.00s
Finished: Pragmas.GetParsedModule Took: 0.00s
Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
Finished: GhcideCodeActions.TypeCheck Took: 0.00s
Finished: GhcideCodeActions.getIdeOptions Took: 0.00s
Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
Finished: GhcideCodeActions.GetFileContents Took: 0.00s
Finished: GhcideCodeActions.GetBindings Took: 0.00s
Finished: GhcideCodeActions.GetParsedModuleWithComments Took: 0.00s
Finished: GhcideCodeActions.GetFileContents Took: 0.00s
Finished: GhcideCodeActions.getParsedModule Took: 0.00s
2022-06-30T02:46:03.399632Z | Debug | src/Ide/Plugin/Eval/CodeLens.hs:127:15 "fp" "/home/kokobd/work/github.com/kokobd/haskell-language-server/refactor-flake/ghcide/src/Development/IDE/Plugin/CodeAction.hs"
src/Ide/Plugin/Eval/CodeLens.hs:127:15 "fp" "/home/kokobd/work/github.com/kokobd/haskell-language-server/refactor-flake/ghcide/src/Development/IDE/Plugin/CodeAction.hs"
2022-06-30T02:46:03.399808Z | Debug | Finished: codeLens.GhcSession Took: 0.00s
2022-06-30T02:46:03.399822Z | Debug | Finished: RefineImports Took: 0.00s
2022-06-30T02:46:03.399822Z | Debug | Finished:  Took: 0.00s
2022-06-30T02:46:03.399869Z | Debug | Finished: codeLens.TypeCheck Took: 0.00s
Finished: codeLens.GhcSession Took: 0.00s
2022-06-30T02:46:03.399876Z | Debug | Finished: ModuleName.ghcSession Took: 0.00s
2022-06-30T02:46:03.399895Z | Debug | Finished: codeLens.GetBindings Took: 0.00s
2022-06-30T02:46:03.399909Z | Debug | Finished: eval.GetParsedModuleWithComments Took: 0.00s
2022-06-30T02:46:03.399916Z | Debug | Finished: codeLens.GetGlobalBindingTypeSigs Took: 0.00s
Finished: RefineImports Took: 0.00s
Finished:  Took: 0.00s
Finished: codeLens.TypeCheck Took: 0.00s
Finished: ModuleName.ghcSession Took: 0.00s
Finished: codeLens.GetBindings Took: 0.00s
Finished: eval.GetParsedModuleWithComments Took: 0.00s
Finished: codeLens.GetGlobalBindingTypeSigs Took: 0.00s
2022-06-30T02:46:14.475744Z | Info | Live bytes: 26.33MB Heap size: 591.40MB
[Info  - 10:46:14 AM] Live bytes: 26.33MB Heap size: 591.40MB

My thoughts on this

There might be something wrong on haskell.nix side, but HLS shouldn't panic on partial function in any case. So something has to be fixed in HLS too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    os: nixostype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions