doomemacs/modules/lang/haskell/README.org

112 lines
3.2 KiB
Org Mode
Raw Normal View History

2017-08-21 20:07:07 +02:00
#+TITLE: :lang haskell
2017-05-25 20:08:50 +02:00
2017-10-18 17:55:04 +02:00
This module adds [[https://www.haskell.org/][Haskell]] support, powered by either [[https://haskell-lang.org/intero][intero]] (the default) or [[https://github.com/jyp/dante][dante]].
2017-05-25 20:08:50 +02:00
+ Code completion (~company-ghc~)
+ Look up documentation (~hoogle~)
+ eldoc support (~dante~)
+ REPL (~ghci~)
+ Syntax-checking (~flycheck~)
+ Code navigation (~dante~)
+ [[https://github.com/hlissner/emacs-snippets/tree/master/haskell-mode][Snippets]]
#+begin_quote
2017-10-18 17:55:04 +02:00
Haskell contends with C and Ruby as my favorite language. My Haskell code will never save the world, but I'll reach for it for small projects and programming exercises (like projecteuler.com or exercism.io).
2017-05-25 20:08:50 +02:00
2017-10-18 17:55:04 +02:00
I'd love to incorporate it into my machine learning work, but Python and Julia hold that crown. For now.
2017-05-25 20:08:50 +02:00
#+end_quote
2017-08-21 20:07:07 +02:00
* Table of Contents :TOC:
- [[#install][Install]]
2017-10-18 17:55:04 +02:00
- [[#intero][Intero]]
- [[#dante][Dante]]
2017-08-21 20:07:07 +02:00
- [[#troubleshooting][Troubleshooting]]
- [[#resources][Resources]]
2017-05-25 20:08:50 +02:00
2017-08-21 20:07:07 +02:00
* Install
2017-10-18 17:55:04 +02:00
This module has two submodules: *Intero* or *Dante*. To activate one, specify one or the other in your pubilc ~init.el~, e.g.:
2017-05-25 20:08:50 +02:00
2017-10-18 17:55:04 +02:00
#+BEGIN_SRC emacs-lisp
(doom! :lang (haskell +intero))
;; or
(doom! :lang (haskell +dante))
#+END_SRC
Your dependencies will change slightly, depending on which you choose:
** Intero
*** Haskell
To get started you must install *stack*:
**** MacOS
2017-05-25 20:08:50 +02:00
#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes")
2017-08-21 20:07:07 +02:00
brew install haskell-stack
stack setup
2017-05-25 20:08:50 +02:00
#+END_SRC
2017-10-18 17:55:04 +02:00
**** Arch Linux
2017-05-25 20:08:50 +02:00
#+BEGIN_SRC sh :dir /sudo:: :tangle (if (doom-system-os 'arch) "yes")
2017-08-21 20:07:07 +02:00
sudo pacman --needed --noconfirm -S stack
# Replace pacaur with your AUR package manager of choice
pacaur --needed --noconfirm -S ncurses5-compat-lib
stack setup
2017-05-25 20:08:50 +02:00
#+END_SRC
2017-10-18 17:55:04 +02:00
*** External dependencies
This module requires ~ghc-mod~.
2017-05-25 20:08:50 +02:00
#+BEGIN_SRC sh
2017-08-21 20:07:07 +02:00
stack install ghc-mod
2017-05-25 20:08:50 +02:00
#+END_SRC
2017-08-21 20:07:07 +02:00
Also ensure that ~\~/.local/bin~ is in ~PATH~:
2017-05-25 20:08:50 +02:00
#+BEGIN_SRC sh
# place this in your profile file, like ~/.bash_profile or ~/.zshenv
2017-08-21 20:07:07 +02:00
export PATH="~/.local/bin:$PATH"
2017-05-25 20:08:50 +02:00
#+END_SRC
2017-10-18 17:55:04 +02:00
** Dante
*** Haskell
To get started with Dante and Haskell, you must install cabal
+ cabal (the haskell package builder)
+ ghc/ghci (the compiler, syntax checker & repl)
**** MacOS
#+BEGIN_SRC sh
brew install cabal-install ghc
#+END_SRC
**** Arch Linux
#+BEGIN_SRC sh
sudo pacman --needed --noconfirm -S cabal-install ghc
#+END_SRC
*** External dependencies
Dante requires ~ghc-mod~ and ~hoogle~:
#+BEGIN_SRC sh
cabal update
cabal install happy haskell-src-exts # ghc-mod/hoogle dependencies
cabal ghc-mod hoogle
#+END_SRC
And add Cabal's bin path to $PATH:
#+BEGIN_SRC sh
export PATH="$HOME/.cabal/bin:$PATH"
#+END_SRC
2017-08-21 20:07:07 +02:00
* Troubleshooting
2017-10-18 17:55:04 +02:00
+ Stack users: a ~dist/setup-config~ in your project may cause [[ https://github.com/DanielG/ghc-mod/wiki#known-issues-related-to-stack][ghc-mod to not
work]].
2017-05-25 20:08:50 +02:00
2017-08-21 20:07:07 +02:00
* Resources
2017-05-25 20:08:50 +02:00
Here are a few resources I've found indespensible in my Haskell adventures:
+ [[http://learnyouahaskell.com/][Learn you a haskell for great good]]
+ [[http://haskellbook.com/][Haskell Programming from first principles]]
+ [[https://github.com/krispo/awesome-haskell][Awesome Haskell]]: an extensive list of haskell resources
2017-10-18 17:55:04 +02:00
+ [[https://docs.haskellstack.org/en/stable/README/][The Haskell Tool Stack docs]]