wiki:Tools/GHC

Glasgow (Glorious) Haskell Compiler

install ghc package from your OS

sudo apt-get install ghc alex happy

clone the latest LTS release

git clone --branch=ghc-8.4.4-release --recurse-submodules git://git.haskell.org/ghc.git

set some safe defaults for Clang (notice no explicit -pthread flag

export CC=clang

export CFLAGS="-Wformat -Wformat-security -Werror=format-security \
    -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 \
    -fstack-protector-strong -fstack-protector-all --param ssp-buffer-size=4 \
    -Wstrict-aliasing=2 -fno-strict-aliasing \
    -D_FILE_OFFSET_BITS=64 \
    -ffunction-sections -fdata-sections \
    -m64 -march=native -mtune=native -O3 \
    -fPIC \
    -I/usr/local/include"

export LDFLAGS="-L/usr/local/lib \
    -rtlib=compiler-rt \
    -fPIC \
    -Wl,--gc-sections -Wl,--as-needed \
    -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack"

build

cd ghc
./boot && ./configure --prefix=/usr/local --with-ghc=/usr/bin/ghc
make -s all
sudo make -s install

install stack binary (the idiotic way)

wget -qO- https://get.haskellstack.org/ | sh

to build it from the sources you need guess what?

git clone https://github.com/commercialhaskell/stack.git
cd stack
stack setup && stack build

setting up some sane defaults in .stack/config.yaml

system-ghc: true

and in .stack/global-project/stack.yaml

resolver: lts-12.16

then run

stack update

Make sure everything works correctly (we need the cabal binary, of course)

stack install cabal-install

then run

cabal update

A documentation search tool

stack install hoogle

REPL wrapper for editors

stack install intero

Lint

stack install hlint

Formatters

stack install hdevtools hindent

Unnecessary wrapping (3 layers!)

stack ghci --with-ghc intero

Editor support

Language Server

git clone --recurse-submodules git://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine
stack install

it has ghc-mod built in

Emacs

(package-install 'lsp-mode)
(package-install 'lsp-ui)
(package-install 'lsp-haskell)
(package-install 'haskell-mode)
(package-install 'intero)

Neovim

cd ~/.local/share/nvim/plugged/
git clone git://github.com/autozimu/LanguageClient-neovim.git
cd LanguageClient-neovim
cargo install --force

then in .config/nvim/init.vim

let g:LanguageClient_autoStart = 1

let g:LanguageClient_serverCommands = {
    \ 'haskell': ['hie-wrapper']
}
Last modified 3 years ago Last modified on Nov 12, 2018, 1:29:39 PM
Note: See TracWiki for help on using the wiki.