refactor!(haskell): remove dante support

BREAKING CHANGE: Now that haskell-language-server is mature there is
little reason not to pick it over dante.
This commit is contained in:
Itai Y. Efrat 2021-08-03 19:20:45 +03:00
parent 6f2e05ea76
commit a20cd88e8e
8 changed files with 9 additions and 75 deletions

View file

@ -172,7 +172,7 @@ following properties:
:path [STRING] path to category root directory
Example:
(doom-module-set :lang 'haskell :flags '(+dante))"
(doom-module-set :lang 'haskell :flags '(+lsp))"
(puthash (cons category module) plist doom-modules))
(defun doom-module-path (category module &optional file)

View file

@ -117,7 +117,7 @@ Modules that bring support for a language or group of languages to Emacs.
+ [[file:../modules/lang/fstar/README.org][fstar]] - F* support
+ [[file:../modules/lang/gdscript/README.org][gdscript]] =+lsp= - TODO
+ [[file:../modules/lang/go/README.org][go]] =+lsp= - TODO
+ [[file:../modules/lang/haskell/README.org][haskell]] =+dante +lsp= - TODO
+ [[file:../modules/lang/haskell/README.org][haskell]] =+lsp= - TODO
+ hy - TODO
+ [[file:../modules/lang/idris/README.org][idris]] - TODO
+ java =+meghanada +eclim +lsp= - TODO

View file

@ -132,7 +132,7 @@
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
;;(go +lsp) ; the hipster dialect
;;(haskell +dante) ; a language that's lazier than I am
;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
;;json ; At least it ain't XML

View file

@ -1,41 +0,0 @@
;;; lang/haskell/+dante.el -*- lexical-binding: t; -*-
;;;###if (featurep! +dante)
(use-package! dante
:hook (haskell-mode-local-vars . dante-mode)
:init
(setq dante-load-flags '(;; defaults:
"+c"
"-Wwarn=missing-home-modules"
"-fno-diagnostics-show-caret"
;; necessary to make attrap-attrap useful:
"-Wall"
;; necessary to make company completion useful:
"-fdefer-typed-holes"
"-fdefer-type-errors"))
:config
(when (featurep! :checkers syntax)
(flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint)))
(set-company-backend! 'dante-mode #'dante-company)
(defadvice! +haskell--restore-modified-state-a (fn &rest args)
"Marks the buffer as falsely modified.
Dante quietly saves the current buffer (without triggering save hooks) before
invoking flycheck, unexpectedly leaving the buffer in an unmodified state. This
is annoying if we depend on save hooks to do work on the buffer (like
reformatting)."
:around #'dante-async-load-current-buffer
(let ((modified-p (buffer-modified-p)))
(apply fn args)
(if modified-p (set-buffer-modified-p t))))
(when (featurep 'evil)
(add-hook 'dante-mode-hook #'evil-normalize-keymaps))
(map! :map dante-mode-map
:localleader
"t" #'dante-type-at
"i" #'dante-info
"l" #'haskell-process-load-file
"e" #'dante-eval-block
"a" #'attrap-attrap))

View file

@ -18,15 +18,13 @@
- [[#troubleshooting][Troubleshooting]]
* Description
This module adds [[https://www.haskell.org/][Haskell]] support, powered by either [[https://github.com/jyp/dante][dante]] (the default) or LSP
This module adds [[https://www.haskell.org/][Haskell]] support, powered by LSP
(haskell-language-server).
+ Code completion (~company-ghc~)
+ Look up documentation (~hoogle~)
+ eldoc support (~dante~)
+ REPL (~ghci~)
+ Syntax-checking (~flycheck~)
+ Code navigation (~dante~)
+ [[https://github.com/hlissner/doom-snippets/tree/master/haskell-mode][Snippets]]
** External resources
@ -38,31 +36,19 @@ Here are a few resources I've found indispensable in my Haskell adventures:
+ [[https://docs.haskellstack.org/en/stable/README/][The Haskell Tool Stack docs]]
** Module Flags
+ =+dante= Enables dante; a fork of intero aimed at lightweightedness. It
doesn't depend on =stack=, supports both ~cabal~-only and ~stack~ projects,
but lacks eldoc support.
+ =+lsp= Enables LSP support with haskell-language-server (requires the ~:tools lsp~ module).
** Plugins
+ [[https://github.com/haskell/haskell-mode][haskell-mode]]
+ =+dante=
+ [[https://github.com/jyp/dante][dante]]
+ [[https://github.com/jyp/attrap][attrap]]
+ =+lsp=
+ [[https://github.com/emacs-lsp/lsp-haskell][lsp-haskell]]
* Prerequisites
Depending on whether you use Dante or haskell-language-server, your
dependencies will differ:
+ Dante users need =cabal=, =ghc= and =ghc-mod=
+ LSP users need the =haskell-language-server= LSP server
+ All users will need the =hoogle= package
** Cabal
To use Dante, you need =cabal= (the haskell package builder) and =ghci= (the
compiler, syntax checker & repl):
*** MacOS
#+BEGIN_SRC sh
brew install cabal-install ghc
@ -112,12 +98,6 @@ stack setup
** Haskell packages
You'll need to install the following packages using ~stack~ or ~cabal~:
+ (Dante users) =ghc-mod=
#+BEGIN_SRC sh
stack install ghc-mod
# or
cabal install ghc-mod
#+END_SRC
+ =hoogle=
#+BEGIN_SRC sh
cabal update

View file

@ -46,5 +46,4 @@
;;
;;; Backends
(cond ((featurep! +dante) (load! "+dante"))
((featurep! +lsp) (load! "+lsp")))
(when (featurep! +lsp) (load! "+lsp"))

View file

@ -5,8 +5,7 @@
(featurep! :tools lsp))
"This module requires (:tools lsp)")
(when (featurep! +dante)
(unless (executable-find "cabal")
(unless (executable-find "cabal")
(warn! "Couldn't find cabal, haskell-mode may have issues"))
(unless (executable-find "hlint")
(warn! "Couldn't find hlint. Flycheck may have issues in haskell-mode")))
(unless (executable-find "hlint")
(warn! "Couldn't find hlint. Flycheck may have issues in haskell-mode"))

View file

@ -3,9 +3,6 @@
(package! haskell-mode :pin "98ba3922360199d5260d47f417f096730ad057c5")
(when (featurep! +dante)
(package! dante :pin "8741419333fb85ed2c1d71f5902688f5201b0a40")
(package! attrap :pin "a5bc695af27349ae6fe4541a581e6fd449d2a026"))
(when (and (featurep! +lsp)
(not (featurep! :tools lsp +eglot)))
(package! lsp-haskell :pin "4e62cf897dd9e9fcef25c6e8e483490a07a5d439"))