如何在 Ubuntu 16.04.1 上安装 ghc 7.6.3?

如何在 Ubuntu 16.04.1 上安装 ghc 7.6.3?

好的,所以我正在尝试学习如何用 haskell 编写代码,因为与 C 相比,它很棒。我的问题是,从官方 GHC 网站下载它后,我不知道如何进行设置:https://www.haskell.org/ghc/download_ghc_7_6_3

我下载了这个版本并解压,然后在终端中按照以下步骤操作:https://www.haskell.org/downloads/linux,具体如下:

sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
sudo apt-get install -y cabal-install-1.22 ghc-7.6.3
cat >> ~/.bashrc <<EOF
export PATH="\$HOME/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.6.3/bin:\$PATH"
EOF
export PATH=~/.cabal/bin:/opt/cabal/1.22/bin:/opt/ghc/7.6.3/bin:$PATH

终端无法识别命令“cat”...报告以下内容:

bash: export: `/.cabal/bin:/opt/ghc/7.6.3/bin:': not a valid identifier
bash: warning: here-document at line 120 delimited by end-of-file (wanted `EOF')
Command 'cat' is available in '/bin/cat'
The command could not be located because '/bin' is not included in the PATH environment variable.
cat: command not found

它也安装不了“software-properties-common”,不管它是什么。然后我下载了 Stack,但我不知道该怎么用它。说明说把它放入 PATH 中,但我不知道怎么做。

相关内容