GHCup: universal installer
(“Ghcup-Universal-Installer” n.d.)
ghcup tuiGHCup 은 Haskell 에서 프로그래밍하는 데 필요한 모든 것을 설치하고 해당 설치(업데이트, 버전 전환 등)를 관리하는 데 도움을 주는 Haskell 용 범용 설치 프로그램입니다. GHCup 에는 루트/관리자 액세스가 필요하지 않습니다. GHCup 웹페이지의 지침에 따라 GHCup 을 설치하세요. 그런 다음 이를 사용하여 다음으로 구성된 Haskell 툴체인을 설치합니다.
GHC(하스켈 컴파일러) 아래에서는 GHC 를 사용하여 예제를 실행하지만 실제로는 GHC 대신 Cabal 또는 Stack 과 같은 도구를 사용하여 코드를 직접 작성하게 됩니다.
HLS (The Haskell Language Server) HLS 를 직접 사용하지 않고, 대신 코드 편집기가 백그라운드에서 HLS 를 사용하여 Haskell 코드를 편집하는 동안 훌륭한 경험을 제공합니다.
-
Cabal(Haskell 빌드 도구) Cabal 을 사용하여 Haskell 프로젝트를 구성하고, 빌드하고, 실행하고, 종속성을 정의합니다.
-
Stack (A Haskell build tool) An alternative to Cabal. Stack(Haskell 빌드 도구) Cabal 의 대안입니다.
-
Cabal and Stack: which one should I install?
- We recommend installing both. Most Haskell projects can be built using Cabal, but some might require Stack. Installing both guarantees that you can use either, and while following a tutorial or book you can use whatever they recommend.
- 둘 다 설치하는 것이 좋습니다. 대부분의 Haskell 프로젝트는 Cabal 을 사용하여 구축할 수 있지만 일부는 Stack 이 필요할 수도 있습니다. 두 가지를 모두 설치하면 둘 중 하나를 사용할 수 있으며 튜토리얼이나 책을 따르는 동안 그들이 권장하는 것은 무엇이든 사용할 수 있습니다.
일단 우분투에 설치 된 모든 것을 지운다.
sudo apt-get remove ghc ghc-doc hlint haskell-stack cabal-install hoogle --purge
sudo rm -Rf /usr/local/lib/haskell-language-server-2.4.0.0개발 환경 ghcup
https://www.haskell.org/ghcup/#
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
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 tuiUser Guide - GHCup - haskell.org
# System GHC (works on all stack versions)
stack config set install-ghc false --global
stack config set system-ghc true --global
# 들어가서 9.6.5 설치하라.
ghu tui
ghcup set ghc 9.6.5
# ghcup set ghc 9.4.8 이건 지워라!
hls 설치 방법 : stack lts-22.26 지원
이걸로 설치하면, 2.7.0 버전을 설치한다.
이렇게 되면 현재 기본인 9.4.8 버전은 커버한다. 다만 Stack lts-22.26의 기본인 9.6.5를 지원할 수 없다.
그렇다면 이렇게 설치하면 안된다.
2.9.0 버전을 다운 받아서 설치하면 된다.
9.4.8, 9.6.5이렇게 설치하면 된다. 그러면 왓슨 하스켈 stack 을 커버할 수 있다. haskell/haskell-language-server/releases - github.com[[https://github.com/haskell/haskell-language-server/releases][haskell/haskell-language-server/releases - github.com]ㅕ
ghcup --url-source=https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-vanilla-0.0.8.yaml install hls 2.9.0.0
➜ haskell-language-server-wrapper --version
haskell-language-server version: 2.9.0.0 (GHC: 9.10.1) (PATH: /home/junghan/.ghcup/hls/2.9.0.0/lib/haskell-language-server-2.9.0.0/bin/haskell-language-server-wrapper)
(base) ~/temp
버전을 맞춰야 한다.cabal : hlint hoogle
cabal install hlint
cabal install hoogle설치 전 1000메가 -> 2300메가
cabal-hoogle
consult-hoogle 이 연동 된다. 이 녀석을 사용한다. 빌드가 죙일 걸려. 아무렴 9.6.5로 빌드하니까 됬다.
git clone https://github.com/kokobd/cabal-hoogle.git
cd cabal-hoogle
cabal install exe:cabal-hoogle
remote: Enumerating objects: 254, done.
remote: Counting objects: 100% (139/139), done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 254 (delta 58), reused 85 (delta 46), pack-reused 115
오브젝트를 받는 중: 100% (254/254), 60.99 KiB | 4.69 MiB/s, 완료.
델타를 알아내는 중: 100% (90/90), 완료.
Wrote tarball sdist to
/home/junghan/temp/cabal-hoogle/dist-newstyle/sdist/cabal-hoogle-3.10.0.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
- HTTP-4000.4.1 (lib) (requires download & build)
- call-stack-0.4.0 (lib) (requires download & build)
- co-log-core-0.3.2.2 (lib) (requires download & build)
- colour-2.3.6 (lib) (requires build)
- cryptohash-sha256-0.11.102.1 (lib) (requires download & build)생성하자. 이것도 오래걸리네
cabal-hoogle generate
➜ cabal-hoogle generate
Resolving dependencies...
Build profile: -w ghc-9.6.5 -O0
In order, the following will be built (use -v for more details):
- OneTuple-0.4.2 (lib) (requires build)
- StateVar-1.2.2 (lib) (requires build)
stack 글로벌 ghc 사용
별도로 버전을 설치하지 않게 하는 게 우선이다. 여튼 사용하지 않는게 좋다.
# System GHC (works on all stack versions)
stack config set install-ghc false --global
stack config set system-ghc true --global9.6.5 버전이다.
➜ cat stack.yaml
resolver: lts-22.26먼저 아래 파일을 주석하라 No compiler found, expected minor version match with ghc-9.6.5 (x86_64-tinfo6) (based on resolver setting in home/junghan.stack/global-project/stack.yaml).
To install the correct version of GHC into the subdirectory for the specified platform in Stack’s directory for local tools (home/junghan.stack/programs/x86_64-linux/), try running stack setup or use the —install-ghc flag. To use your system GHC installation, run stack config set system-ghc —global true, or use the —system-ghc flag.
스택의 로컬 도구용 디렉터리(home/junghan.stack/programs/x86_64-linux/)에서 지정된 플랫폼의 하위 디렉터리에 올바른 버전의 GHC 를 설치하려면 스택 설정을 실행하거나 —install-ghc 플래그를 사용하세요. 시스템 GHC 설치를 사용하려면 스택 구성 설정 system-ghc —global true 를 실행하거나 —system-ghc 플래그를 사용하세요.
이맥스 이글랏 사용하라!
잘된다. 둠이맥스 기준으로.
별도로 consult-hoogle 을 설치했다.
왓슨 stack 개발 환경으로 코드 지원 확인
stack.yaml 버전이 글로벌 ghc 와 hls hlint hoogle 과 호환하기 때문에 문제가 없다. 다음을 열어보라.
~/sync/code/haskell_tutorial_cookbook_examples/Pure/Simple.hs
exercism 지원
기본으로 stack.yaml 을 사용한다. 버전이 낮으므로 맞춰줘야 한다. 왓슨은 버전이 최신이니. 여기에 맞추면 된다.
#keyword
-
bib/ @GwernBranwen Gwern 위키 블로그 디지털가든 구루 장인 ‘2025-03-08 #2025-03-08
-
bib/ @BartoszMilewski #프로그래머 #카테고리이론 ‘2025-05-23 #2025-05-23
BIBLIOGRAPHY
“Ghcup-Universal-Installer.” n.d. Accessed April 2, 2025. https://www.haskell.org/get-started/#ghcup-universal-installer.
Comments