Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 3.31 KB

DEVELOPMENT.md

File metadata and controls

84 lines (61 loc) · 3.31 KB

Development

Requirements

  • Nix

  • We recommend that you make use of Cachix to speed up your builds.

    Once you have installed cachix, configure it to use this project's cache:

    cachix use funflow

Development environment

A shell.nix file is available to provide with the minimum environment to develop and build the library.

nix-shell

Non-exaustive list of things provided by the shell:

  • Stack (with Nix integration preconfigured)
  • Haskell Language Server (HLS) which can be used with any LSP-compatible editor to improve the Haskell development experience (code navigation, completion, typechecking, etc.)
  • Ormolu formatter

VS Code

Plugin requirements:

Install and start Docker

For tasks like running tests and executing some of the tutorials, Docker should be up and running on your machine. Check out the official Docker website for more information about installation, and perhaps about the Docker daemon.

Optional: Enable Direnv

Direnv additionally provides auto-loading when navigating into directories in shells. Thus you can rely on it to automatically load shell.nix whenever you cd to Funflow (and/or when you navigate to the funflow-tutorial subdirectory which has another shell.nix) while keeping your favorite shell (ZSH, Bash, Fish...).

  • install globally direnv (e.g. nix-env --install direnv)
  • install globally nix-direnv (e.g. nix-env --install nix-direnv)
  • create a file .envrc at the root of Funflow containing use nix
  • enable direnv integration in Funflow directory: direnv allow (and do the same)
  • repeat 2 previous steps for funflow-tutorial/ subdirectory
  • now whenever you cd into a Funflow directory or sub-directory, your shell will be configured with dependencies as if you were in nix-shell.

Build with stack

All the usual stack commands should work out of the box, that is:

  • Build
    stack build funflow
  • Run tests
    stack test
  • Launch a REPL (Read-Eval-Print-Loop, also called GHCI in Haskell lingo):
    stack repl

Updating the Nix dependencies

If you want to use more recent packages (e.g a more recent GHC version by updating the stackage resolver, or a more recent Haskell Language Server), you may need to update the Nix dependencies:

niv update