Skip to content

Latest commit

 

History

History
93 lines (59 loc) · 3.91 KB

Haskell.md

File metadata and controls

93 lines (59 loc) · 3.91 KB

Haskell

Templates

Templates provide extensive information about setting up development environment and packaging Haskell apps.

Tools

ghcid

ghcid is a Very low feature GHCi based IDE. It can be used to re-run a function in a given file on changes in a given directory. This template provides a sample configuration for this tool in the .ghcid file.

hpack

hpack translates package.yaml into .cabal.

Nix

haskell4nix

haskell.nix

Stack

Uses haskell4nix.

Stack support Nix integration.

Stack uses nix-shell.

The name of the file providing a Nix shell can be customized in stack.yaml.

Here's the format of that file - docs.

The shell file can import the contents of flake.nix via flake-compat.

flake.nix provides an output stack-shell.${system} = {version}: ....

stack.nix imports flake.nix and provides a shell.

devShells

Completions for CLI apps

devShells.default = pkgs.mkShell {
    buildInputs = [ packageExe ];
    shellHook = ''
      source ${packageExe}/share/bash-completion/completions/${packageExecutableName}
    '';
  };

Troubleshooting

Haskell Language Server

Clear cache

Sometimes, HLS finds errors in code despite cabal build running successfully. If you use VS Code, find Outputs of Haskell Language Server and determine the cache directory for a project.

It should have approximately this form: /home/<user name>/.cache/hie-bios/dist-<project-name>-<something>. Remove it and restart HLS.