[英]How can I install a recent version of the Haskell GHC compiler on Ubuntu?
I noticed that I'm running an old version of GHC on Ubuntu 15.04. 我注意到我在Ubuntu 15.04上运行旧版本的GHC。 Can I get a newer one without having to compile it from source?
我可以在不必从源代码编译的情况下获得更新的吗?
I highly recommend using Stack . 我强烈建议使用Stack 。 It has made my life 110% easier and solves your problem.
它让我的生活更容易110%并解决了你的问题。
You can get GHC 7.8
with 1106 packages that won't break (no cabal hell, no cabal sandbox install marathons) or you can get GHC 7.10
with 1028 packages - source . 你可以得到
GHC 7.8
7.8,1106套装不会破坏(没有阴谋集团,没有cabal沙箱安装马拉松),或者你可以获得GHC 7.10
和1028套餐 - 来源 。
You can even run different versions of GHC
in different projects! 您甚至可以在不同的项目中运行不同版本的
GHC
! Check the FAQ for details. 查看常见问题解答了解详情 To install if you are on an Ubuntu system, follow the installation docs .
要安装在Ubuntu系统上,请按照安装文档进行安装 。
Edit : Just tried to create a new stack
project with GHC 7.10
and there was a bit more to it than first expected. 编辑 :刚刚尝试使用
GHC 7.10
创建一个新的stack
项目,并且它比预期的要多一些。 After installing stack
you will run: 安装
stack
您将运行:
stack new
Then, you'll need to edit your stack.yaml
, and change the default resolver from 然后,您需要编辑
stack.yaml
,并更改默认的解析器
resolver: lts-2.19
to: 至:
resolver: ghc-7.10
Then you can run: 然后你可以运行:
stack setup
Or 要么
stack build --install-ghc # to build as well!
and you will have a new stack
project with GHC 7.10
. 你将有一个
GHC 7.10
的新stack
项目。 Reference for stack.yaml
is here . stack.yaml
在这里 。
There is a PPA with prepackaged binaries for many recent versions of GHC. 对于许多最近版本的GHC,有一个预包装二进制文件的PPA。
Add the following to your /etc/apt/sources.list.d/extra-ppas.list
file: 将以下内容添加到
/etc/apt/sources.list.d/extra-ppas.list
文件中:
deb http://ppa.launchpad.net/hvr/ghc/ubuntu vivid main deb-src http://ppa.launchpad.net/hvr/ghc/ubuntu vivid main
Install one of the PPA's versions of GHC. 安装PPA的GHC版本之一。 They are named
tool-version
while the ones that come with Ubuntu are simply named tool
. 它们被命名为
tool-version
而Ubuntu附带tool-version
只是命名tool
。 The most recent at the time of this writing is ghc-7.10.2
, for example. 例如,撰写本文时最新的是
ghc-7.10.2
。
GHC will be installed under /opt/ghc/<version>/bin
. GHC将安装在
/opt/ghc/<version>/bin
。 Add this folder to your path to use that version of GHC. 将此文件夹添加到您的路径以使用该版本的GHC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.