Haskell-language-server, and non-project workflows - General

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Jonathan Reeve

I have this non-project Haskell project, which is just a single Shakefile.hs. It uses a few other libraries, but is just that one file. All the dependencies are declared in a default.nix that looks like this:

{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865" }:
let
  inherit (nixpkgs) pkgs;
  ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [
          shake lucid pandoc wai-app-static
        ]);
in
pkgs.stdenv.mkDerivation {
  name = "lili-elbe";
  buildInputs = [ ghc pkgs.nodejs ];
  shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)";
}

And I can compile the project with just nix-shell --run shake. So far so good. But how can I get the haskell-language-server, or hie-bios, to recognize my project, such that when I load the file in Emacs, it doesn't give me a hundred import errors? I also have direnv set up, and an .envrc that just says use_nix.

Jonathan Reeve

I know I can make a .cabal file and have HIE read that to find dependencies. But that seems like overkill, when I don't even have a Main.hs or a src/ directory.

Torsten Schmits

I guess you could use a direct cradle and specify -package lucid etc

Torsten Schmits

not sure how that works