Merge pull request #761 from patrl/haskellKeybindings
Haskell quality-of-life improvements
This commit is contained in:
commit
243eab954a
4 changed files with 41 additions and 4 deletions
|
@ -3,6 +3,24 @@
|
||||||
|
|
||||||
(def-package! dante
|
(def-package! dante
|
||||||
:hook (haskell-mode . dante-mode)
|
:hook (haskell-mode . dante-mode)
|
||||||
|
:init
|
||||||
|
(setq dante-load-flags '(;; defaults:
|
||||||
|
"+c"
|
||||||
|
"-Wwarn=missing-home-modules"
|
||||||
|
"-fno-diagnostics-show-caret"
|
||||||
|
;; neccessary to make attrap-attrap useful:
|
||||||
|
"-Wall"
|
||||||
|
;; necessary to make company completion useful:
|
||||||
|
"-fdefer-typed-holes"
|
||||||
|
"-fdefer-type-errors"))
|
||||||
:config
|
:config
|
||||||
(when (featurep! :feature syntax-checker)
|
(when (featurep! :feature syntax-checker)
|
||||||
(flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint))))
|
(flycheck-add-next-checker 'haskell-dante '(warning . haskell-hlint)))
|
||||||
|
|
||||||
|
(map! :map dante-mode-map
|
||||||
|
:localleader
|
||||||
|
:n "t" #'dante-type-at
|
||||||
|
:n "i" #'dante-info
|
||||||
|
:n "l" #'haskell-process-load-or-reload
|
||||||
|
:n "e" #'dante-eval-block
|
||||||
|
:n "a" #'attrap-attrap))
|
||||||
|
|
|
@ -13,6 +13,15 @@ This is necessary because `intero-mode' doesn't do its own error checks."
|
||||||
(message "Couldn't find stack. Refusing to enable intero-mode."))))
|
(message "Couldn't find stack. Refusing to enable intero-mode."))))
|
||||||
(add-hook 'haskell-mode-hook #'+haskell|init-intero)
|
(add-hook 'haskell-mode-hook #'+haskell|init-intero)
|
||||||
:config
|
:config
|
||||||
|
(setq haskell-compile-cabal-build-command "stack build --fast")
|
||||||
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
|
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
|
||||||
(when (featurep! :feature syntax-checker)
|
(when (featurep! :feature syntax-checker)
|
||||||
(flycheck-add-next-checker 'intero '(warning . haskell-hlint))))
|
(flycheck-add-next-checker 'intero '(warning . haskell-hlint)))
|
||||||
|
|
||||||
|
(map! :map intero-mode-map
|
||||||
|
:localleader
|
||||||
|
:n "t" #'intero-type-at
|
||||||
|
:n "i" #'intero-info
|
||||||
|
:n "l" #'intero-repl-load
|
||||||
|
:nv "e" #'intero-repl-eval-region
|
||||||
|
:n "a" #'intero-apply-suggestions))
|
||||||
|
|
|
@ -15,5 +15,14 @@
|
||||||
(set-lookup-handlers! 'haskell-mode :definition #'haskell-mode-jump-to-def-or-tag)
|
(set-lookup-handlers! 'haskell-mode :definition #'haskell-mode-jump-to-def-or-tag)
|
||||||
(set-file-template! 'haskell-mode :trigger #'haskell-auto-insert-module-template :project t)
|
(set-file-template! 'haskell-mode :trigger #'haskell-auto-insert-module-template :project t)
|
||||||
(set-repl-handler! '(haskell-mode haskell-cabal-mode literate-haskell-mode) #'+haskell-repl-buffer)
|
(set-repl-handler! '(haskell-mode haskell-cabal-mode literate-haskell-mode) #'+haskell-repl-buffer)
|
||||||
(add-to-list 'completion-ignored-extensions ".hi"))
|
|
||||||
|
(add-to-list 'completion-ignored-extensions ".hi")
|
||||||
|
|
||||||
|
(map! :map haskell-mode-map
|
||||||
|
:localleader
|
||||||
|
;; this is set to use cabal for dante users and stack for intero users:
|
||||||
|
:n "b" #'haskell-process-cabal-build
|
||||||
|
:n "c" #'haskell-cabal-visit-file
|
||||||
|
:n "p" #'hindent-reformat-buffer
|
||||||
|
:v "p" #'hindent-reformat-region))
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
(package! hindent)
|
(package! hindent)
|
||||||
|
|
||||||
(cond ((featurep! +dante)
|
(cond ((featurep! +dante)
|
||||||
(package! dante))
|
(package! dante)
|
||||||
|
(package! attrap))
|
||||||
((package! intero)))
|
((package! intero)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue