Last Updated: May 26, 2018
·
3.126K
· seuros

Install Haskell's Cabal/Stack on Ubuntu

Cabal

sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
sudo apt-get install -y cabal-install-1.22 ghc-7.10.2
cat >> ~/.bashrc <<EOF
export PATH=~/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.10.2/bin:$PATH
EOF
# Remember to edit .bashrc everytime you upgrade cabal from the repository.
source ~/.bashrc
cabal --version #check you have the correct version
cabal update
# Optionally you can install Alex and Happy
# Alex is a lexical analyser generator
# Happy is a parser generator
cabal install alex happy

Stack

wget -q -O- https://s3.amazonaws.com/download.fpcomplete.com/ubuntu/fpco.key | sudo apt-key add -
echo "deb http://download.fpcomplete.com/ubuntu/$(lsb_release -sc) stable main"|sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update
sudo apt-get install stack -y