📖 WIPIVERSE

🔍 Currently registered entries: 103,112건

Stack (Haskell)

Stack is a cross-platform program for developing Haskell projects. It is designed to automate the building, testing, and deployment of Haskell code, and to manage dependencies in a reproducible way. It essentially acts as a project build tool and dependency resolver, aiming to provide a consistent and reliable development environment.

Key Features and Functionality:

  • Dependency Management: Stack utilizes package descriptions (usually a stack.yaml file) to define the project's dependencies. It uses a curated package set known as the Stackage LTS (Long-Term Support) or Nightly snapshots. These snapshots provide a known-good, consistent set of package versions that are tested to work together. This mitigates dependency conflicts often encountered when working with multiple Haskell packages.

  • Project Setup: Stack simplifies the creation of new Haskell projects. It provides templates and scaffolds for different project types, such as libraries, executables, or cabal packages. This allows developers to quickly start new projects with a pre-configured directory structure and build settings.

  • Build Automation: Stack automates the build process. It compiles the project's code, links libraries, and generates executables. It leverages the Cabal build system behind the scenes but provides a simplified and more controlled interface.

  • Testing: Stack integrates with testing frameworks, such as Hspec and QuickCheck. It provides commands to run tests and generate reports.

  • Reproducible Builds: By using Stackage snapshots and managing dependencies explicitly, Stack aims to ensure that builds are reproducible across different machines and environments. This is crucial for collaborative development and continuous integration.

  • GHC Version Management: Stack can manage different versions of the Glasgow Haskell Compiler (GHC). It can automatically download and install the required GHC version for a project, ensuring that the project is built with the correct compiler.

  • Package Publishing: Stack facilitates the publication of Haskell packages to Hackage, the central package repository for Haskell.

Relationship to Cabal:

Stack is often contrasted with Cabal, the traditional build system for Haskell. While Stack utilizes Cabal behind the scenes, it introduces the concept of Stackage snapshots and provides a more opinionated and user-friendly interface. Stack aims to address some of the common challenges associated with Cabal, such as dependency conflicts and reproducibility issues.

In essence, Stack aims to make Haskell project development easier and more reliable by providing a comprehensive tool for dependency management, build automation, and project setup.