6.4 KiB
The Haskell Tool Stack
stack
is a cross-platform program for developing Haskell
projects. It is aimed at Haskellers both new and experienced.
It features:
- Installing GHC automatically, in an isolated location.
- Installing packages needed for your project.
- Building your project.
- Testing your project.
- Benchmarking your project.
How to install
Downloads are available by operating system:
Note: if you are using cabal-install to install stack, you may need to pass a
constraint to work around a
Cabal issue: cabal install --constraint 'mono-traversable >= 0.9' stack
.
How to use
Go into a Haskell project directory and run stack build
. If everything is
already configured, this will:
- Download the package index.
- Download and install all necessary dependencies for the project.
- Build and install the project.
You may be prompted to run some of the following along the way:
stack new
to create a brand new project.stack init
to create a stack configuration file for an existing project. stack will figure out what Stackage release (LTS or nightly) is appropriate for the dependencies.stack setup
to download and install the correct GHC version in an isolated location (default~/.stack
) that won't interfere with any system-level installations. (For information on installation paths, please use thestack path
command.)
If you just want to install an executable using stack, then all you have
to do is stack install <package-name>
.
Run stack
for a complete list of commands.
How to contribute
This assumes that you have already installed a version of stack, and have git
installed.
- Clone
stack
from git withgit clone https://github.com/commercialhaskell/stack.git
. - Enter into the stack folder with
cd stack
. - Build
stack
using a pre-existingstack
install withstack setup && stack build
. - Once
stack
finishes building, check the stack version withstack --version
. Make sure the version is the latest. - Look for issues tagged with
newcomer
andawaiting-pr
labels
Build from source as a one-liner:
git clone https://github.com/commercialhaskell/stack.git && \
cd stack && \
stack setup && \
stack build
Complete guide to stack
This repository also contains a complete user guide to using stack , covering all of the most common use cases.
Questions, Feedback, Discussion
- For frequently asked questions about detailed or specific use-cases, please see the FAQ.
- For general questions, comments, feedback and support please write to the stack mailing list.
- For bugs, issues, or requests please open an issue.
- When using Stack Overflow, please use the haskell-stack tag.
Why stack?
stack is a project of the Commercial Haskell group, spearheaded by FP Complete. It is designed to answer the needs of commercial Haskell users, hobbyist Haskellers, and individuals and companies thinking about starting to use Haskell. It is intended to be easy to use for newcomers, while providing the customizability and power experienced developers need.
While stack itself has been around since June of 2015, it is based on codebases used by FP Complete for its corporate customers and internally for years prior. stack is a refresh of that codebase combined with other open source efforts like stackage-cli to meet the needs of users everywhere.
A large impetus for the work on stack was a large survey of people interested in Haskell, which rated build issues as a major concern. The stack team hopes that stack can address these concerns.
Documentation Table Of Contents
- Project Documentation
- Maintainer Guide: includes releasing information
- Signing Key: downloadable stack binaries are signed with this key
- Tool Documentation
- Build Command: reference for the syntax of the build command and the command line targets
- Dependency Visualization: uses Graphviz
- Docker Integration
- FAQ: frequently asked questions about detailed or specific use-cases
- Install/Upgrade: a list of downloads available by operating system, installation instructions, and upgrade instructions
- Nonstandard Project Initialization
- Shell Autocompletion
- User Guide: in-depth tutorial covering the most common use cases and all major stack features (requires no prior Haskell tooling experience)
- YAML Configuration: reference for writing
stack.yaml
files
- Advanced Documentation
- Architecture: reference for people curious about stack internals, wanting to get involved deeply in the codebase, or wanting to use stack in unusual ways