You'll likely need the following two packages:įor Ubuntu 15.10: sudo apt-key adv -keyserver -recv-keys 575159689BEFB442Įcho 'deb wily main' |sudo tee /etc/apt//fpco.list Stack is only available in AUR at this moment.
#Brew install haskell install#
Probably the easiest way to install is using homebrew: brew install haskell-stack Arch Linux See stack documentation, but we present the cliffs notes below. It also doesn't replace Hackage, but provides 'snapshots' of it through Stackage. Stack doesn't replace Cabal, but does replace cabal-install. Stack also manages the version of GHC used as part of a snapshot. A project using Stack simply declares the snapshot they are using, and no dependency resolution needs to be performed. They create a set of packages called a 'snapshot' where they try to guarantee that all packages part of a snapshot are compatible with each other and have all their dependencies contained in the snapshot. Stack and it's backing website, Stackage, instead solve this problem globally and once for everyone. It also doesn't manage GHC itself, considering that out of scope.
![brew install haskell brew install haskell](https://miro.medium.com/max/1264/1*CqnyWhSiyNq_1Jgipa8FVQ.png)
It may resolve package A to version 1.0 on one developers machine, and resolve package A to version 1.1 on a different developers machine if run at different times. However, cabal-install doesn't do a great job of giving developers reproducible builds. cabal-install later adopted a 'sandbox' strategy where a project could install dependencies local to the project, which helps greatly. This was particularly bad due to the use a single global package installation location, meaning all projects had to have compatible versions of packages. This works, but led to a problem known as 'cabal-hell' (similar to DLL-hell on Windows), where cabal-install would fail to find a way to solve the dependency problem. cabal-install also interacts with a package hosting website, Hackage, for retrieving dependencies during the build process.Įach time a client of cabal-install configured a package to prepare it for building or installation, cabal-install would perform dependency resolution, resolving which version of packages A, B and C to use, such that all packages chosen are compatible with each other and all dependencies are satisfied.
#Brew install haskell how to#
Traditionally, Haskell programmers used a tool called cabal-install that knows how to build a Cabal package. It also provides common infrastructure for building and distributing packages. It describes what a package is and how packages interact with the language. Stack vs CabalĬabal is the package description format for Haskell. After that, all package versions are fixed, determined upstream by Stackage's snapshot mechanism. When installing a new package, you don't choose which version to install, instead when starting a project using Stack, you choose which Stackage snapshot to use. Stackage uses the concept of 'snapshots', where all packages part of the same snapshot are meant to be compatible with each other. Stack is backed by the Stackage package system. To do this, it manages (and freezes) all your dependencies and the version of GHC being used for your project.
![brew install haskell brew install haskell](https://miro.medium.com/max/1104/1*DVqSdKOort2Y0Z3tGKqFeQ.png)
Stack is a build system for Haskell that aims to give you extremely reproducible builds. We will be using GHC 7.10 throughout this course.
![brew install haskell brew install haskell](https://www.tutorialspoint.com/haskell/images/linux_installer.jpg)
Our motivation for recommending Stack is that we believe it is easier for beginners to work with, particularly as it manages the version of GHC used so that you aren't reliant on your OS package manager. This document tries to quickly explain the situation.
![brew install haskell brew install haskell](https://qph.fs.quoracdn.net/main-thumb-722460100-200-beiijvpycezgvtqxvmamuiamlcweuqgg.jpeg)
You will see many references to Cabal and cabal-install on the Internet for Haskell projects. Building Haskell Projects Building Haskell Projectsįor this class, we recommend you use the new Stack Haskell build system.