demo-emacs-haskell
demo-emacs-haskell copied to clipboard
A tutorial for using Emacs with Haskell projects
#+TITLE: Using Emacs with Haskell Projects
-
About
A tutorial about using Emacs to develop Haskell projects. Only basic Haskell and Emacs knowledge is required.
The tutorial attempts to cover several of the Emacs packages that one often uses when writing Haskell:
- /company/
- /flycheck/
- /haskell-mode/
- /haskell-snippets/
- /helm/
- /hlint-refactor/
- /intero/
- /projectile/
- /use-package/
- /which-key/
- /yasnippet/
If you are new to Emacs, go through its tutorial first (press =control+h= followed by =t=).
This was originally presented for the "PDX Emacs Hackers" group. Some of the people attending were not Haskellers, hence the sparse section on basic Haskell.
-
Setup
*** Haskell Tools
1. Install [[https://docs.haskellstack.org/en/stable/install_and_upgrade/][Stack]]
2. Install sandboxed GHC and dependencies
#+BEGIN_SRC sh
stack setup
stack build --dependencies-only --test
#+END_SRC
3. Install tools
#+BEGIN_SRC sh
stack build intero
stack install apply-refact codex hasktags hlint
codex set format emacs
#+END_SRC
This might take a while.
*** Emacs
1. Move any preexisting Emacs configurations
#+BEGIN_SRC sh
for f in ~/.emacs*; do
if [ -e "$f" ]; then
echo "Moving config to $f.orig"
mv "$f" "$f.orig"
fi
done
#+END_SRC
2. Use this project's configuration
#+BEGIN_SRC sh
cp -r emacs.d ~/.emacs.d
#+END_SRC
3. (Re)start Emacs
It will take up to a couple of minutes for Emacs to download and compile
all dependencies.
4. Follow the [[file:demo.org][tutorial]]