LoginSignup
12
4

More than 3 years have passed since last update.

haskell-ide-engineの導入

Posted at

はじめに

Haskellの勉強を始めようと思い、諸ツールの導入を進めている中で、某コーヒーショップでテザリングしながらhaskell-ide-engineを導入しようとしてギガが大量に奪われてしまったので、自戒の念を込めて投稿するものである。

環境

  • MacBook Pro 2018年モデル
    intel Core i5 2.3GHz メモリ8GB
  • macOS Mojave 10.14.5
  • Homebrew 2.1.8
  • stack 2.1.3
  • ghc 8.6.5

どうやっていたか

まず以下のコマンドでクローンしてくる。
$ git clone https://github.com/haskell/haskell-ide-engine --recursive
このままインストールを進めると途中でこけるらしいので以下をコールしておく。
$ brew reinstall gmp
ここまではいい。
この後にhaskell-ide-engineディレクトリに入って以下をコールしていた。
$ ./install.hs build-all
参考にした記事では1時間強で終わっていたが2時間近く待っても終わらない…
(もちろん端末スペックもありますが)
しかもバージョンひとつにつき200MB超の通信してる…

どうするべきだったか

前提として、stack入れているのでそもそもstack使えという話で、以下のようにしてhelpを見ます。

$ stack ./install.hs help
run from: stack

Usage:
    stack install.hs <target>
    or
    cabal new-run install.hs --project-file shake.project <target>

Targets:
    help                 Show help message including all targets

    build                Builds hie with all installed GHCs
    build-all            Builds hie for all installed GHC versions and the data files
    build-data           Get the required data-files for `hie` (Hoogle DB)
    hie-8.2.2            Builds hie for GHC version 8.2.2
    hie-8.4.2            Builds hie for GHC version 8.4.2
    hie-8.4.3            Builds hie for GHC version 8.4.3
    hie-8.4.4            Builds hie for GHC version 8.4.4
    hie-8.6.1            Builds hie for GHC version 8.6.1
    hie-8.6.2            Builds hie for GHC version 8.6.2
    hie-8.6.3            Builds hie for GHC version 8.6.3
    hie-8.6.4            Builds hie for GHC version 8.6.4
    hie-8.6.5            Builds hie for GHC version 8.6.5

    stack-build          Builds hie with all installed GHCs; with stack
    stack-build-all      Builds hie for all installed GHC versions and the data files; with stack
    stack-build-data     Get the required data-files for `hie` (Hoogle DB); with stack
    stack-hie-8.2.2      Builds hie for GHC version 8.2.2; with stack
    stack-hie-8.4.2      Builds hie for GHC version 8.4.2; with stack
    stack-hie-8.4.3      Builds hie for GHC version 8.4.3; with stack
    stack-hie-8.4.4      Builds hie for GHC version 8.4.4; with stack
    stack-hie-8.6.1      Builds hie for GHC version 8.6.1; with stack
    stack-hie-8.6.2      Builds hie for GHC version 8.6.2; with stack
    stack-hie-8.6.3      Builds hie for GHC version 8.6.3; with stack
    stack-hie-8.6.4      Builds hie for GHC version 8.6.4; with stack
    stack-hie-8.6.5      Builds hie for GHC version 8.6.5; with stack

    cabal-ghcs           Show all GHC versions that can be installed via `cabal-build` and `cabal-build-all`.
    cabal-build          Builds hie with all installed GHCs; with cabal
    cabal-build-all      Builds hie for all installed GHC versions and the data files; with cabal
    cabal-build-data     Get the required data-files for `hie` (Hoogle DB); with cabal
    cabal-hie-8.6.5      Builds hie for GHC version 8.6.5; with cabal

    icu-macos-fix        Fixes icu related problems in MacOS

Build completed in 0.00s

うん、バージョン指定できますね。
そこで次のようにしました。
$ stack install.hs stack-hie-8.6.5
ghcも最新のものしか使う予定がないので8.6.5指定で良かった。
hie-8.6.5というのもあったんですが、stack使うのでstack-hie-8.6.5のほうを指定しました。
何が違うのかは今のところ確認していないですが。
(もちろん全部入れたい場合は前述のbuild-allを指定したら良いです)
制限を入れた結果時間早くなりました。

# stack (for stack-hie-8.6.5)
Build completed in 21m04s

この後以下を実行。
$ stack ./install.hs build-data
このくらいで終わります。

Build completed in 1m31s

終わりに

Nixとか使う方法もあるようですが、とりあえずお手軽そうなほうを。
(そもそもよく調べてないのでNixを理解してないですが)
なお、時間が遅くなってしまってコーヒーショップでのDL・インストールを諦め、この早く終わる方法を知ったのが帰宅してからなのでギガの奪われ損でした。
いったいコーヒーショップで費やした2時間はなんだったんだ。
以下今回の導入にあたって参考にした記事

念のため。記事が悪いとかじゃなくちゃんと色々調べてから実行しましょうね、という話です。

12
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
4