haskell-template

haskell-template (https://github.com/srid/haskell-template) is a template Git repository for ready-made, fully reproducible and friendly Haskell development using Nix. It comes with full IDE support in VSCode (and other editors with LSP support). See Philosophy for what’s (and why it is) included.

Rationale

The goal of haskell-template is to enable anyone to get started with Haskell development without much fanfare (thanks to Nix). I also use haskell-template to bootstrap all of my new Haskell projects. See Getting started to get started.

Documentation

  • Getting started
  • HOWTO
    • nix develop: The nix shell is your friend; inside it, you will have the full Haskell development environment (cabal, ghc, ghci, haskell-language-server, cabal-fmt, hlint, etc.).
    • Common Haskell workflows
      • Useful Scripts

        ScriptDescription
        bin/runRun the main executable via ghcid (auto-recompiles)
        bin/replRun cabal repl
        bin/hoogleRun hoogle (Documentation for dependencies)
      • Adding tests

      • Dependency management

        • How to add a Haskell package dependency

          Add the package to the .cabal file, and re-run nix develop (and restart VSCode). If the package is unavailable, you will have to override it (see next point).

        • How to override a Haskell package in Nix

          Use this tutorial when setting the the overrides option of haskell-flake

    • Common Nix workflows
      • nix build: Build the nix package.
      • nix run .: Run the program via Nix.
        • nix run github:srid/haskell-template: Run the program via Nix remotely.
      • nix profile install github:srid/haskell-template: Install the program via Nix.
      • nix --option sandbox false build .#check -L: Run flake checks 1
    • Switching to direnv
    • CI

Discussion

Comments? Ideas? Post them on GitHub.

Footnotes
1.
We cannot use nix flake check due to IFD. And sandbox is being disabled because of an issue with haskell-language-server.
Links to this page