Merge pull request #761 from patrl/haskellKeybindings

Haskell quality-of-life improvements
This commit is contained in:
Henrik Lissner 2018-07-19 15:22:27 +02:00 committed by GitHub
commit 243eab954a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 4 deletions

View file

@ -3,6 +3,24 @@
(def-package! dante
: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
(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))

View file

@ -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."))))
(add-hook 'haskell-mode-hook #'+haskell|init-intero)
:config
(setq haskell-compile-cabal-build-command "stack build --fast")
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
(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))

View file

@ -15,5 +15,14 @@
(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-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))

View file

@ -5,6 +5,7 @@
(package! hindent)
(cond ((featurep! +dante)
(package! dante))
(package! dante)
(package! attrap))
((package! intero)))