Haskellのインストール
今使っている方法
現在は、以下の方法で haskellをインストールして使っている。
haskellのインストール
$ sudo apt update
$ sudo apt install ghc
この方法でしばらく使っていたのだが、”パッケージ random” をインストールしようとして、
はたと困った。
ネットでやり方を調べても、stackを使うか、ghcupを使うか、それしか情報がなかった。
(もっと調べたらあるんだろうけれど・・・)
ということで、以前のやり方でインストールし直した。
$ sudo apt purge ghc
$ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
Emacsにhaskell-modeをインストールする
M-x list-package
にて、haskell-mode をインストールする。これだけ。
参考
haskell-mode ( https://github.com/haskell/haskell-mode ) の 「Quick Installation」の項目を参照。
以前に書いた内容 (以前は、以下のように haskellをインストールした。)
純粋関数型言語ということで、一度さわっておきたいので、インストールした。
インストールのためのサイト
https://www.haskell.org/ghcup/
インストール
ターミナルにて以下を実行した。
$ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
以下のように出力された。
Welcome to Haskell!
This script can download and install the following binaries:
* ghcup - The Haskell toolchain installer
* ghc - The Glasgow Haskell Compiler
* cabal - The Cabal build tool for managing Haskell software
* stack - A cross-platform program for developing Haskell projects (similar to cabal)
* hls - (optional) A language server for developers to integrate with their editor/IDE
ghcup installs only into the following directory,
which can be removed anytime:
/home/se-ichi/.ghcup
Press ENTER to proceed or ctrl-c to abort.
Note that this script can be re-run at any given time.
Enterを入力した。
------------------------------------------------------------------------------
Detected bash shell on your system...
Do you want ghcup to automatically add the required PATH variable to "/home/se-ichi/.bashrc"?
[P] Yes, prepend [A] Yes, append [N] No [?] Help (default is "P").
「A」を入力した。
------------------------------------------------------------------------------
Do you want to install haskell-language-server (HLS)?
HLS is a language-server that provides IDE-like functionality
and can integrate with different editors, such as Vim, Emacs, VS Code, Atom, ...
Also see https://haskell-language-server.readthedocs.io/en/stable/
[Y] Yes [N] No [?] Help (default is "N").
「Y」を入力した。
------------------------------------------------------------------------------
Do you want to enable better integration of stack with GHCup?
This means that stack won't install its own GHC versions, but uses GHCup's.
For more information see:
https://docs.haskellstack.org/en/stable/yaml_configuration/#ghc-installation-customisation-experimental
If you want to keep stacks vanilla behavior, answer 'No'.
[Y] Yes [N] No [?] Help (default is "Y").
「Y」を入力した。
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15.2M 100 15.2M 0 0 8437k 0 0:00:01 0:00:01 --:--:-- 8437k
[ Info ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file /home/se-ichi/.ghcup/cache/ghcup-0.0.7.yaml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 232k 100 232k 0 0 378k 0 --:--:-- --:--:-- --:--:-- 377k
[ Info ] Upgrading GHCup...
[ Warn ] No GHCup update available
System requirements
Please ensure the following distro packages are installed before continuing (you can exit ghcup and return at any time): build-essential curl libffi-dev libffi8ubuntu1 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5
Press ENTER to proceed or ctrl-c to abort.
Installation may take a while.
Enterを入力した。
Info ] downloading: https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-fedora27-linux.tar.xz as file /home/se-ichi/.ghcup/cache/ghc-9.2.5-x86_64-fedora27-linux.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 235M 100 235M 0 0 9.8M 0 0:00:23 0:00:23 --:--:-- 9128k
[ Info ] verifying digest of: ghc-9.2.5-x86_64-fedora27-linux.tar.xz
[ Info ] Unpacking: ghc-9.2.5-x86_64-fedora27-linux.tar.xz to /home/se-ichi/.ghcup/tmp/ghcup-3e27e60e55c7889b
[ Info ] Installing GHC (this may take a while)
[ Info ] Merging file tree from "/home/se-ichi/.ghcup/tmp/ghcup-b06da21da660ca88/home/se-ichi/.ghcup/ghc/9.2.5" to "/home/se-ichi/.ghcup/ghc/9.2.5"
[ Info ] GHC installation successful
[ Info ] GHC 9.2.5 successfully set as default version
[ Info ] downloading: https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal/3.6.2.0/cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz as file /home/se-ichi/.ghcup/cache/cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4523k 100 4523k 0 0 3481k 0 0:00:01 0:00:01 --:--:-- 3484k
[ Info ] verifying digest of: cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz
[ Info ] Unpacking: cabal-install-3.6.2.0-x86_64-linux-alpine-static.tar.xz to /home/se-ichi/.ghcup/tmp/ghcup-328fe26ed77c4a26
[ Info ] Installing cabal
[ Info ] Cabal installation successful
Config file path source is default config file.
Config file /home/se-ichi/.cabal/config not found.
Writing default configuration to /home/se-ichi/.cabal/config
Downloading the latest package list from hackage.haskell.org
Updated package list of hackage.haskell.org to the index-state 2023-03-21T04:28:56Z
[ Info ] downloading: https://downloads.haskell.org/~hls/haskell-language-server-1.9.0.0/haskell-language-server-1.9.0.0-x86_64-linux-ubuntu20.04.tar.xz as file /home/se-ichi/.ghcup/cache/haskell-language-server-1.9.0.0-x86_64-linux-ubuntu20.04.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 179M 100 179M 0 0 8432k 0 0:00:21 0:00:21 --:--:-- 8609k
[ Info ] verifying digest of: haskell-language-server-1.9.0.0-x86_64-linux-ubuntu20.04.tar.xz
[ Info ] Unpacking: haskell-language-server-1.9.0.0-x86_64-linux-ubuntu20.04.tar.xz to /home/se-ichi/.ghcup/tmp/ghcup-8cf50af3cd1afe03
[ Info ] Installing HLS
[ Info ] Merging file tree from "/home/se-ichi/.ghcup/tmp/ghcup-6557202f4d469834/home/se-ichi/.ghcup/hls/1.9.0.0" to "/home/se-ichi/.ghcup/hls/1.9.0.0"
[ Info ] HLS installation successful
[ Info ] This is just the server part of your LSP configuration. Consult the README on how to
[ ... ] configure HLS, your project and your LSP client in your editor:
[ ... ] https://haskell-language-server.readthedocs.io/en/stable/
[ ... ]
[ Info ] downloading: https://github.com/commercialhaskell/stack/releases/download/v2.9.3/stack-2.9.3-linux-x86_64-static.tar.gz as file /home/se-ichi/.ghcup/cache/stack-2.9.3-linux-x86_64-static.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 13.2M 100 13.2M 0 0 4883k 0 0:00:02 0:00:02 --:--:-- 9139k
[ Info ] verifying digest of: stack-2.9.3-linux-x86_64-static.tar.gz
[ Info ] Unpacking: stack-2.9.3-linux-x86_64-static.tar.gz to /home/se-ichi/.ghcup/tmp/ghcup-df5032e90fafab72
[ Info ] Installing stack
[ Info ] Stack installation successful
[ Info ] Stack manages GHC versions internally by default. To improve integration, please visit:
[ ... ] https://www.haskell.org/ghcup/guide/#stack-integration
[ ... ]
[ ... ] Also check out:
[ ... ] https://docs.haskellstack.org/en/stable/yaml_configuration
[ ... ]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 1044 0 --:--:-- --:--:-- --:--:-- 1044
==============================================================================
OK! /home/se-ichi/.bashrc has been modified. Restart your terminal for the changes to take effect,
or type "source /home/se-ichi/.ghcup/env" to apply them in your current terminal session.
==============================================================================
All done!
To start a simple repl, run:
ghci
To start a new haskell project in the current directory, run:
cabal init --interactive
To install other GHC versions and tools, run:
ghcup tui
If you are new to Haskell, check out https://www.haskell.org/ghcup/steps/
これでインストールが終了したようである。
カテゴリー: Haskell, memo, Ubuntu
タグ: GHC, GHCup, Haskell
カウント: 197