REF clean up haskell section

This commit is contained in:
Nathan Dwarshuis 2020-03-24 20:39:22 -04:00
parent 104f4b550c
commit 3860b4913c
1 changed files with 10 additions and 9 deletions

View File

@ -837,7 +837,7 @@ The major mode package =haskell-mode= is quite comprehensive and has most of wha
- type checking/insertion/annotation - type checking/insertion/annotation
- function info - function info
Since most of these need a GHC session to run properly, just run =haskell-process-load-or-reload= in one of the project files. Since most of these need GHCi to run properly, I added a hook to load haskell source into GHCi when opened.
I have also found this to be much simpler and conflicting with other packages such as =dante= and =intero= (and probably =haskell-ide-engine= and friends). I have also found this to be much simpler and conflicting with other packages such as =dante= and =intero= (and probably =haskell-ide-engine= and friends).
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -849,7 +849,7 @@ I have also found this to be much simpler and conflicting with other packages su
'((company-capf company-dabbrev)))) '((company-capf company-dabbrev))))
(defun nd/haskell-load-maybe () (defun nd/haskell-load-maybe ()
"Prompts user to turn on `auto-fill-mode'." "Prompts user to load haskell source to GHCi."
(when (y-or-n-p "Load Haskell source into GHCi? ") (when (y-or-n-p "Load Haskell source into GHCi? ")
(haskell-process-load-or-reload))) (haskell-process-load-or-reload)))
@ -858,18 +858,25 @@ I have also found this to be much simpler and conflicting with other packages su
:hook ((haskell-mode . origami-mode) :hook ((haskell-mode . origami-mode)
(haskell-mode . company-mode) (haskell-mode . company-mode)
(haskell-mode . haskell-indentation-mode) (haskell-mode . haskell-indentation-mode)
;; this enables better integration with the running GHCi process
(haskell-mode . interactive-haskell-mode) (haskell-mode . interactive-haskell-mode)
(haskell-mode . nd/init-haskell-company) (haskell-mode . nd/init-haskell-company)
(haskell-mode . nd/haskell-load-maybe)) (haskell-mode . nd/haskell-load-maybe)
;; camelcase is defacto for haskell
(haskell-mode . subword-mode))
:config :config
(setq haskell-interactive-popup-errors nil (setq haskell-interactive-popup-errors nil
;; we use stack...which counterintuitively means we set the ;; we use stack...which counterintuitively means we set the
;; cabal build command to be stack ;; cabal build command to be stack
haskell-compile-cabal-build-command "stack build" haskell-compile-cabal-build-command "stack build"
;; use stylish (requires the stylish binary somewhere in $PATH)
haskell-stylish-on-save t)) haskell-stylish-on-save t))
;; this minor mode name is long and unnecessary ;; this minor mode name is long and unnecessary
(delight 'interactive-haskell-mode nil "haskell") (delight 'interactive-haskell-mode nil "haskell")
;; unnecessary to see on the modeline
(delight 'subword-mode nil "subword")
#+END_SRC #+END_SRC
**** hlint **** hlint
This is an additional syntax checker and requires the =hlint= binary (install through stack). This is an additional syntax checker and requires the =hlint= binary (install through stack).
@ -877,12 +884,6 @@ This is an additional syntax checker and requires the =hlint= binary (install th
(with-eval-after-load 'haskell (with-eval-after-load 'haskell
(flycheck-add-next-checker 'haskell-stack-ghc '(t . haskell-hlint))) (flycheck-add-next-checker 'haskell-stack-ghc '(t . haskell-hlint)))
#+END_SRC #+END_SRC
**** camelCase
The defacto style for haskell mandates camelcase, so use subword mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'haskell-mode-hook #'subword-mode)
(delight 'subword-mode nil "subword")
#+END_SRC
**** helper functions **** helper functions
Other helper functions that make haskell even more fun. Other helper functions that make haskell even more fun.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp