Haskell: install from source

First we need to determine the version of ghc to be installed. Newest version not always good. Since we are going to install ghc-mod as final destination, its dependence on ghc version shall be the final judge. Check this page for more info about version restriction.

To install haskell, first need to check documentation.

As it says, minimal installation includes ghc, cabal & stack. It also seems that stack & cabal are equal. And in some circumstances cabal is better than stack, so we choose cabal.

Directly install ghc from source takes time.. The prerequisites suggests:

<Quote>

In general, we support building with the previous 2 major releases, e.g.:

  • To build 6.8.* you need GHC >= 6.4
  • To build 6.10.* you need GHC >= 6.6
  • To build 7.4.* you need GHC >= 7.0
  • To build 7.6.* you need GHC >= 7.2
  • To build 7.8.* you need GHC >= 7.4
  • To build 7.10.* you need GHC >= 7.6
  • To build 8.0.* you need GHC >= 7.8
  • To build 8.2.* you need GHC >= 7.10

</Quote>

Recursive building..

So in order to use the newest version of ghc, it seems we need first to get the very fresh binary of ghc and use it to build ghc from source .. all binary/sources can be found here.

Also build cabal from source needs ghc, and newest version of possible ghc is preferred, otherwise bugs might drive you crazy. And cabal repository seems been gfw-ed.

Using cabal to install ghc-mod, because it seems needed by haskell-completion vimscripts.

cabal can only install packages, cannot remove, if need to remove, first install a package called cabal-uninstall, then ~/.cabal/bin/cabal-uninstall shall uninstall packages.

posted on 2017-09-22 12:07  三叁  阅读(293)  评论(0编辑  收藏  举报

导航