简体   繁体   English

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

[英]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。

  1. 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

  2. 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

  3. 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.

相关问题 我可以在当前的Haskell平台上使用更新的GHC吗? - Can I use a more recent GHC with the current Haskell Platform? 如何更改 Stack 上的默认 GHC 编译器版本 - How to I change the default GHC compiler version on Stack 如何更新堆栈项目的 GHC 版本? 错误:GHC 8.10 编译的 ghcide 无法加载包:haskell-language-server-8.10.7 - How can i update the version of my GHC for my stack project? ERROR: ghcide compiled by GHC 8.10 failed to load packages:haskell-language-server-8.10.7 如何在用GHC编译的Haskell函数中找到分配? - How can I find the allocation in a Haskell function compiled with GHC? 如何在有文化的Haskell脚本中启用GHC扩展? - How can I enable GHC extensions in a literate Haskell script? 无法在OS X Yosemite Haskell版本ghc 7.10.1上安装arithmoi - Cannot install arithmoi on OS X Yosemite Haskell version ghc 7.10.1 如何在Ubuntu中的GHC 6.12上安装ThreadScope - How to install ThreadScope on GHC 6.12 in Ubuntu 我可以在GHC 7.4.2上使用haskell平台吗? - Can I use haskell platform with GHC 7.4.2? Ubuntu上Haskell(GHC)中的ThreadDelay问题 - ThreadDelay Problem in Haskell (GHC) on Ubuntu 在Ubuntu 14.04.5中使用Cabal时,如何在Haskell中安装性能分析库? - How can I install profiling libraries in Haskell when using cabal, in Ubuntu 14.04.5?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM