如何在Ubuntu上安装最新版本的Haskell GHC编译器?

时间:2015-07-28 15:18:46

标签: haskell ghc

我注意到我在Ubuntu 15.04上运行旧版本的GHC。我可以在不必从源代码编译的情况下获得更新的吗?

2 个答案:

答案 0 :(得分:11)

我强烈建议您使用Stack。它让我的生活更容易110%并解决了你的问题。

你可以获得GHC 7.8 1106个不会破坏的套餐(没有阴谋集团,没有集合沙箱安装马拉松),或者你可以获得GHC 7.10 1028个套餐 - source

您甚至可以在不同的项目中运行不同版本的GHC!有关详细信息,请查看FAQ。要安装在Ubuntu系统上,请按照installation docs

进行操作

修改:只是尝试使用stack创建一个新的GHC 7.10项目,并且它比预期的要多一些。安装stack后,您将运行:

stack new

然后,您需要修改stack.yaml,并从

更改默认解析器
resolver: lts-2.19

为:

resolver: ghc-7.10

然后你可以运行:

stack setup

或者

stack build --install-ghc  # to build as well!

您将拥有一个stack项目GHC 7.10stack.yaml的参考是here

答案 1 :(得分:5)

There is a PPA with prepackaged binaries for many recent versions of GHC.

  1. Add the following to your /etc/apt/sources.list.d/extra-ppas.list file:

    deb http://ppa.launchpad.net/hvr/ghc/ubuntu vivid main deb-src http://ppa.launchpad.net/hvr/ghc/ubuntu vivid main

  2. Install one of the PPA's versions of GHC. They are named tool-version while the ones that come with Ubuntu are simply named tool. The most recent at the time of this writing is ghc-7.10.2, for example.

  3. GHC will be installed under /opt/ghc/<version>/bin. Add this folder to your path to use that version of GHC.