haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.71k stars 368 forks source link

hls-plugin-api-1.4.0.0 doesn't build with some 1.0.4 #2969

Closed fxttr closed 9 months ago

fxttr commented 2 years ago

Your environment

Which OS do you use: NixOS Which LSP client (editor/plugin) do you use: emacs + lsp-mode Describe your project (alternative: link to the project):

{
  description = "Removing sensitive informations from .nix files";
  inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
  inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
  inputs.flake-utils.url = "github:numtide/flake-utils";

  outputs = { self, nixpkgs, flake-utils, haskellNix }:
    flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
    let
      overlays = [ haskellNix.overlay
        (final: prev: {
          nix-strip =
            final.haskell-nix.project' {
              src = ./.;
              compiler-nix-name = "ghc8107";
              shell.tools = {
                cabal = {};
                ormolu = {};
                haskell-language-server = { modules = [{ reinstallableLibGhc = false; }]; };
              };
              shell.buildInputs = with pkgs; [
                nixpkgs-fmt
              ];
            };
        })
      ];
      pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; };
      flake = pkgs.nix-strip.flake {};
    in flake // {
      defaultPackage = flake.packages."nix_strip:exe:nix_strip-exe";
    });
}

Steps to reproduce

Create a basic cabal project, create flake.nix and run "nix develop ." on NixOS or a system with installed nix package manager

Expected behaviour

Put me in a working development shell with hls.

Actual behaviour

Building the environment crashes with a error message. Please have a look at the link below. Hydra got the same problem.

Include debug information

https://hydra.iohk.io/build/15888389/nixlog/567

michaelpj commented 2 years ago

Fortunately, I know enough about haskell.nix to be able to decipher this :)

The issue started with a newer version of Hackage, and looking at the error, it's talking about GEq which comes from some. Lo and behold, a new version of some was recently released. And indeed, hls-plugin-api does not build with it, which is strange, since it doesn't look like it should change anything.

michaelpj commented 2 years ago

The error is very odd. It's complaining about not being able to deduce instances which are explicitly declared in lsp-types, I don't see how that can happen :thinking:

hamishmack commented 2 years ago

Diffing the cabal generated freeze files gives:

<              any.algebraic-graphs ==0.6,
---
>              any.algebraic-graphs ==0.6.1,
89c89
<              any.dependent-sum ==0.7.1.0,
---
>              any.dependent-sum ==0.6.2.0,
295c295
<              any.some ==1.0.3,
---
>              any.some ==1.0.4,

The problem is that dependent-sum-0.7.1.0 requires some <1.0.4. Cabal must choose between using the latest dependent-sum and the latest some. It chooses to use the latest some and with an older (0.6.2.0).

I have added https://github.com/obsidiansystems/dependent-sum/issues/71

hamishmack commented 2 years ago

@sjakobi indicated (https://github.com/input-output-hk/haskell.nix/pull/1526#issuecomment-1162969895) that https://github.com/obsidiansystems/dependent-sum/issues/71 might not be possible. Perhaps we could add a lower bound of dependent-sum >=0.7.1.0 to hls-plugin-api to prevent it cabal choosing dependent-sum-0.6.2.0?

michaelpj commented 9 months ago

Old, we're well past this now