Closed10

Haskell環境構築

shuntakashuntaka
shuntakashuntaka

brewで入れちゃったけどghcupの方が良さそう(結果的にbrewで入れたものはuninstallしました)

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:
  /Users/shuntaka/.ghcup

Press ENTER to proceed or ctrl-c to abort.
Note that this script can be re-run at any given time.

mason経由で入れるのでN

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").

stackがghcupのghcバージョンを使用するか。よくわからないので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").

これでインストールが始まる

Enterを押す

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  105M  100  105M    0     0  4933k      0  0:00:21  0:00:21 --:--:-- 4625k
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.8.yaml as file /Users/shuntaka/.ghcup/cache/ghcup-0.0.8.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  424k  100  424k    0     0  1691k      0 --:--:-- --:--:-- --:--:-- 1697k
[ Info  ] Upgrading GHCup...
[ Warn  ] No GHCup update available

System requirements
  Note: On OS X, in the course of running ghcup you will be given a dialog box to install the command line tools. Accept and the requirements will be installed for you. You will then need to run the command again.
On Darwin M1 you might also need a working llvm installed (e.g. via brew) and have the toolchain exposed in PATH.
Press ENTER to proceed or ctrl-c to abort.
Installation may take a while.

brewで入れたのが気がかりだけどうまくいっている気がする

これで良さそう

$ which stack
/Users/shuntaka/.ghcup/bin/stack

shuntakashuntaka

TODO
Neovim側で:Masonで、haskell-language-serverを選択

haskell-language-server入ったっぽい

shuntakashuntaka
stack new book

stack buildすると、最新のコンパイラを落としてきてよくわからないことになるので、以下の記述が必要

stack.yaml
+resolver: lts-20.11
+compiler: ghc-9.4.8
shuntakashuntaka

LSPを動いているけど、ghcup経由ではなくMason経由なのでバージョンが違うことによる問題が出そう 🤔
とりあえず今は動作しているから放置。

shuntakashuntaka

haskell-tools.nvim周りは未調査だけど、これはある程度言語触らないと必要が生まれないから一旦Closeしよう

このスクラップは5ヶ月前にクローズされました