Skip to content

Instantly share code, notes, and snippets.

@dcastro
Last active October 19, 2018 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcastro/866ddab2bb25952247519f01d392f142 to your computer and use it in GitHub Desktop.
Save dcastro/866ddab2bb25952247519f01d392f142 to your computer and use it in GitHub Desktop.
Haskell Setup (macos)

Setup

curl -sSL https://get.haskellstack.org/ | sh


stack new <project-name> simple-hpack
cd <project-name>

// build project
stack build

// install dev tools
stack install ghcid
stack build intero

// run
stack run

Dev environment

  • install vscode plugins: Haskero
  • cmd+shift+p > Terminal: create new integrated terminal
  • In the new terminal, run ghcid. You can either:
    • Add /Users/<user>/.local/bin/ to your path if it's not there already, and run ghcid --command "stack ghci"
    • Or run it like this if you don't want to alter your path: stack exec ghcid -- --command 'stack ghci'
  • Ghcid will compile the program on every change and tell you about warnings/errors. You can also ask ghcid to compile and run your program on every change by adding --run

Other stuff:

  • start a repl for interactive development: stack ghci, quit with :q
  • to add a new dependency, add an entry to dependencies in package.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment