2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- Haskell Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq haskell-packages
|
2018-11-20 19:55:37 +00:00
|
|
|
'(
|
|
|
|
cmm-mode
|
|
|
|
company
|
|
|
|
(company-cabal :requires company)
|
2017-07-27 19:29:19 +00:00
|
|
|
|
2018-11-20 19:55:37 +00:00
|
|
|
;; ghci completion backend
|
2018-11-04 18:02:28 +00:00
|
|
|
(company-ghci :requires company)
|
2019-08-02 19:33:15 +00:00
|
|
|
|
2018-11-20 19:55:37 +00:00
|
|
|
;; ghc-mod completion backend
|
2018-11-04 18:02:28 +00:00
|
|
|
(company-ghc :requires company)
|
|
|
|
ghc
|
2017-07-27 19:29:19 +00:00
|
|
|
|
2018-11-20 19:55:37 +00:00
|
|
|
;; intero completion backend
|
2018-11-04 18:02:28 +00:00
|
|
|
(intero :requires company)
|
2017-07-27 19:29:19 +00:00
|
|
|
|
2018-11-20 19:55:37 +00:00
|
|
|
;; dante completion backend
|
2018-11-07 06:35:09 +00:00
|
|
|
(dante :requires company)
|
2019-07-21 15:56:47 +00:00
|
|
|
;; dante auto refactor companion
|
|
|
|
(attrap :requires dante)
|
2017-07-27 19:29:19 +00:00
|
|
|
|
2019-01-22 12:51:24 +00:00
|
|
|
lsp-haskell
|
|
|
|
|
2018-11-20 19:55:37 +00:00
|
|
|
flycheck
|
|
|
|
(flycheck-haskell :requires flycheck)
|
|
|
|
ggtags
|
|
|
|
haskell-mode
|
|
|
|
haskell-snippets
|
|
|
|
counsel-gtags
|
|
|
|
helm-gtags
|
|
|
|
(helm-hoogle :requires helm)
|
|
|
|
hindent
|
|
|
|
hlint-refactor
|
|
|
|
))
|
2014-12-21 16:03:27 +00:00
|
|
|
|
2019-01-22 12:51:24 +00:00
|
|
|
(defun haskell/init-lsp-haskell()
|
|
|
|
(use-package lsp-haskell
|
|
|
|
:defer t))
|
|
|
|
|
2015-04-03 22:37:01 +00:00
|
|
|
(defun haskell/init-cmm-mode ()
|
|
|
|
(use-package cmm-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-04-03 22:37:01 +00:00
|
|
|
|
2018-11-04 17:57:07 +00:00
|
|
|
(defun haskell/post-init-company ()
|
2018-11-04 18:02:55 +00:00
|
|
|
(add-hook 'haskell-mode-local-vars-hook #'spacemacs-haskell//setup-company)
|
|
|
|
(add-hook 'literate-haskell-mode-local-vars-hook #'spacemacs-haskell//setup-company))
|
2017-07-27 19:29:19 +00:00
|
|
|
|
2016-05-01 15:36:11 +00:00
|
|
|
(defun haskell/init-company-cabal ()
|
|
|
|
(use-package company-cabal
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-07-27 19:29:19 +00:00
|
|
|
:init
|
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends company-cabal
|
|
|
|
:modes haskell-cabal-mode)))
|
2016-05-01 15:36:11 +00:00
|
|
|
|
2016-06-10 16:53:07 +00:00
|
|
|
(defun haskell/init-company-ghci ()
|
|
|
|
(use-package company-ghci
|
2018-11-04 17:57:07 +00:00
|
|
|
:defer t))
|
2015-03-29 00:44:30 +00:00
|
|
|
|
2016-06-10 16:53:07 +00:00
|
|
|
(defun haskell/init-company-ghc ()
|
|
|
|
(use-package company-ghc
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2014-12-12 03:34:13 +00:00
|
|
|
|
2015-04-10 04:00:51 +00:00
|
|
|
(defun haskell/init-ghc ()
|
|
|
|
(use-package ghc
|
2017-07-27 19:29:19 +00:00
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(dolist (mode haskell-modes)
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mm" "haskell/ghc-mod")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"mt" 'ghc-insert-template-or-signature
|
|
|
|
"mu" 'ghc-initial-code-from-signature
|
|
|
|
"ma" 'ghc-auto
|
|
|
|
"mf" 'ghc-refine
|
|
|
|
"me" 'ghc-expand-th
|
|
|
|
"mn" 'ghc-goto-next-hole
|
|
|
|
"mp" 'ghc-goto-prev-hole
|
|
|
|
"m>" 'ghc-make-indent-deeper
|
|
|
|
"m<" 'ghc-make-indent-shallower
|
|
|
|
"hi" 'ghc-show-info
|
|
|
|
"ht" 'ghc-show-type))
|
|
|
|
(when (configuration-layer/package-used-p 'flycheck)
|
|
|
|
;; remove overlays from ghc-check.el if flycheck is enabled
|
|
|
|
(set-face-attribute 'ghc-face-error nil :underline nil)
|
|
|
|
(set-face-attribute 'ghc-face-warn nil :underline nil)))))
|
2017-05-27 20:57:22 +00:00
|
|
|
|
2016-06-10 16:53:07 +00:00
|
|
|
(defun haskell/init-intero ()
|
|
|
|
(use-package intero
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-06-10 16:53:07 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs|diminish intero-mode " λ" " \\")
|
|
|
|
(advice-add 'intero-repl-load
|
2017-07-27 19:29:19 +00:00
|
|
|
:around #'haskell-intero//preserve-focus)
|
|
|
|
|
|
|
|
(dolist (mode haskell-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"gb" 'xref-pop-marker-stack
|
|
|
|
"hi" 'intero-info
|
|
|
|
"ht" 'intero-type-at
|
|
|
|
"hT" 'haskell-intero/insert-type
|
|
|
|
"rs" 'intero-apply-suggestions
|
|
|
|
"sb" 'intero-repl-load))
|
|
|
|
|
|
|
|
(dolist (mode (cons 'haskell-cabal-mode haskell-modes))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"sc" nil
|
|
|
|
"sS" 'haskell-intero/display-repl
|
|
|
|
"ss" 'haskell-intero/pop-to-repl))
|
|
|
|
|
|
|
|
(dolist (mode (append haskell-modes '(haskell-cabal-mode intero-repl-mode)))
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mi" "haskell/intero")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"ic" 'intero-cd
|
|
|
|
"id" 'intero-devel-reload
|
|
|
|
"ik" 'intero-destroy
|
|
|
|
"il" 'intero-list-buffers
|
|
|
|
"ir" 'intero-restart
|
|
|
|
"it" 'intero-targets))
|
|
|
|
|
|
|
|
(evil-define-key '(insert normal) intero-mode-map
|
|
|
|
(kbd "M-.") 'intero-goto-definition))))
|
|
|
|
|
|
|
|
(defun haskell/init-dante ()
|
|
|
|
(use-package dante
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(dolist (mode haskell-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
2019-11-15 10:49:24 +00:00
|
|
|
"gb" 'xref-pop-marker-stack
|
2017-07-27 19:29:19 +00:00
|
|
|
"ht" 'dante-type-at
|
|
|
|
"hT" 'spacemacs-haskell//dante-insert-type
|
|
|
|
"hi" 'dante-info
|
|
|
|
"rs" 'dante-auto-fix
|
|
|
|
"se" 'dante-eval-block
|
|
|
|
"sr" 'dante-restart)))))
|
2016-06-10 16:53:07 +00:00
|
|
|
|
2019-07-21 15:56:47 +00:00
|
|
|
(defun haskell/init-attrap ()
|
|
|
|
(use-package attrap
|
|
|
|
:defer t))
|
|
|
|
|
2016-06-10 16:53:07 +00:00
|
|
|
(defun haskell/init-helm-hoogle ()
|
|
|
|
(use-package helm-hoogle
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-06-10 16:53:07 +00:00
|
|
|
:init
|
|
|
|
(dolist (mode haskell-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode "hf" 'helm-hoogle))))
|
|
|
|
|
|
|
|
(defun haskell/post-init-flycheck ()
|
2017-02-14 03:27:29 +00:00
|
|
|
(spacemacs/enable-flycheck 'haskell-mode))
|
2016-06-10 16:53:07 +00:00
|
|
|
|
|
|
|
(defun haskell/init-flycheck-haskell ()
|
|
|
|
(use-package flycheck-haskell
|
|
|
|
:commands flycheck-haskell-configure
|
|
|
|
:init (add-hook 'flycheck-mode-hook 'flycheck-haskell-configure)))
|
|
|
|
|
2017-07-27 19:29:19 +00:00
|
|
|
(defun haskell/post-init-ggtags ()
|
2018-11-04 18:02:55 +00:00
|
|
|
(add-hook 'haskell-mode-local-vars-hook #'spacemacs/ggtags-mode-enable)
|
|
|
|
(add-hook 'literate-haskell-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2017-07-27 19:29:19 +00:00
|
|
|
|
2014-12-02 04:22:45 +00:00
|
|
|
(defun haskell/init-haskell-mode ()
|
|
|
|
(use-package haskell-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-11-02 20:24:17 +00:00
|
|
|
:init
|
2015-11-03 04:16:57 +00:00
|
|
|
(progn
|
2018-11-04 17:57:07 +00:00
|
|
|
(add-hook 'haskell-mode-local-vars-hook #'spacemacs-haskell//setup-backend)
|
2018-11-04 18:02:55 +00:00
|
|
|
(add-hook 'literate-haskell-mode-local-vars-hook #'spacemacs-haskell//setup-backend)
|
2018-11-04 17:57:07 +00:00
|
|
|
|
2015-11-03 04:16:57 +00:00
|
|
|
(defun spacemacs//force-haskell-mode-loading ()
|
|
|
|
"Force `haskell-mode' loading when visiting cabal file."
|
|
|
|
(require 'haskell-mode))
|
|
|
|
(add-hook 'haskell-cabal-mode-hook
|
2016-06-24 15:37:01 +00:00
|
|
|
'spacemacs//force-haskell-mode-loading)
|
|
|
|
|
2017-02-02 12:11:57 +00:00
|
|
|
;; Haskell cabal files interact badly with electric-indent-mode
|
|
|
|
;; note: we cannot add this hook in :config, since haskell-mode might
|
|
|
|
;; only be loaded after cabal-mode hooks are already run (see add-hook above)
|
|
|
|
(add-hook 'haskell-cabal-mode-hook #'spacemacs-haskell//disable-electric-indent)
|
|
|
|
|
2016-06-24 15:37:01 +00:00
|
|
|
(setq
|
|
|
|
;; Use notify.el (if you have it installed) at the end of running
|
|
|
|
;; Cabal commands or generally things worth notifying.
|
|
|
|
haskell-notify-p t
|
|
|
|
;; Remove annoying error popups
|
|
|
|
haskell-interactive-popup-errors nil
|
|
|
|
;; Better import handling
|
|
|
|
haskell-process-suggest-remove-import-lines t
|
|
|
|
haskell-process-auto-import-loaded-modules t
|
|
|
|
;; Disable haskell-stylish-on-save, as it breaks flycheck highlighting.
|
|
|
|
;; NOTE: May not be true anymore - taksuyu 2015-10-06
|
2016-09-05 02:29:41 +00:00
|
|
|
haskell-stylish-on-save nil))
|
2014-12-02 04:22:45 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-10-24 07:58:12 +00:00
|
|
|
(defun spacemacs/haskell-interactive-bring ()
|
|
|
|
"Bring up the interactive mode for this session without
|
|
|
|
switching to it."
|
|
|
|
(interactive)
|
|
|
|
(let* ((session (haskell-session))
|
|
|
|
(buffer (haskell-session-interactive-buffer session)))
|
|
|
|
(display-buffer buffer)))
|
|
|
|
|
2015-04-01 16:04:43 +00:00
|
|
|
;; hooks
|
2017-05-23 13:34:24 +00:00
|
|
|
(add-hook 'haskell-mode-hook #'spacemacs-haskell//disable-electric-indent)
|
2015-04-01 16:04:43 +00:00
|
|
|
|
2015-10-16 05:59:50 +00:00
|
|
|
;; prefixes
|
2016-02-07 18:48:44 +00:00
|
|
|
(dolist (mode haskell-modes)
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mg" "haskell/navigation")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "ms" "haskell/repl")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mc" "haskell/cabal")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mh" "haskell/documentation")
|
2016-08-29 14:01:53 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode mode "md" "haskell/debug")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mr" "haskell/refactor"))
|
2015-10-24 08:06:55 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'haskell-interactive-mode "ms" "haskell/repl")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'haskell-cabal-mode "ms" "haskell/repl")
|
2017-10-19 13:25:35 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'intero-repl-mode "ms" "haskell/repl")
|
2015-10-16 05:59:50 +00:00
|
|
|
|
2015-04-01 16:04:43 +00:00
|
|
|
;; key bindings
|
|
|
|
(defun spacemacs/haskell-process-do-type-on-prev-line ()
|
|
|
|
(interactive)
|
2016-06-10 16:53:07 +00:00
|
|
|
(haskell-process-do-type 1))
|
2014-12-21 16:03:27 +00:00
|
|
|
|
2020-01-14 11:47:44 +00:00
|
|
|
;; repl key bindings
|
|
|
|
(evil-define-key 'insert haskell-interactive-mode-map
|
|
|
|
(kbd "C-j") 'haskell-interactive-mode-history-next
|
|
|
|
(kbd "C-k") 'haskell-interactive-mode-history-previous
|
|
|
|
(kbd "C-l") 'haskell-interactive-mode-clear)
|
|
|
|
|
2019-08-02 19:33:15 +00:00
|
|
|
;; Bind repl
|
|
|
|
(spacemacs/register-repl 'haskell
|
|
|
|
'haskell-interactive-switch "haskell")
|
|
|
|
|
2016-02-07 18:48:44 +00:00
|
|
|
(dolist (mode haskell-modes)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"sb" 'haskell-process-load-file
|
|
|
|
"sc" 'haskell-interactive-mode-clear
|
2017-10-19 13:25:35 +00:00
|
|
|
"sS" 'spacemacs/haskell-interactive-bring
|
|
|
|
"ss" 'haskell-interactive-switch
|
2019-08-02 19:33:15 +00:00
|
|
|
"'" 'haskell-interactive-switch
|
2014-12-21 16:03:27 +00:00
|
|
|
|
2016-02-07 18:48:44 +00:00
|
|
|
"ca" 'haskell-process-cabal
|
|
|
|
"cb" 'haskell-process-cabal-build
|
|
|
|
"cc" 'haskell-compile
|
|
|
|
"cv" 'haskell-cabal-visit-file
|
2014-12-21 16:03:27 +00:00
|
|
|
|
2016-02-07 18:48:44 +00:00
|
|
|
"hd" 'inferior-haskell-find-haddock
|
2016-06-10 16:53:07 +00:00
|
|
|
"hi" 'haskell-process-do-info
|
|
|
|
"ht" 'haskell-process-do-type
|
2016-02-07 18:48:44 +00:00
|
|
|
"hT" 'spacemacs/haskell-process-do-type-on-prev-line
|
2015-11-18 00:38:05 +00:00
|
|
|
|
2016-06-08 03:36:06 +00:00
|
|
|
"da" 'haskell-debug/abandon
|
2016-02-07 18:48:44 +00:00
|
|
|
"db" 'haskell-debug/break-on-function
|
|
|
|
"dB" 'haskell-debug/delete
|
|
|
|
"dc" 'haskell-debug/continue
|
2016-06-08 03:36:06 +00:00
|
|
|
"dd" 'haskell-debug
|
|
|
|
"dn" 'haskell-debug/next
|
|
|
|
"dN" 'haskell-debug/previous
|
|
|
|
"dp" 'haskell-debug/previous
|
|
|
|
"dr" 'haskell-debug/refresh
|
|
|
|
"ds" 'haskell-debug/step
|
2018-01-24 17:50:32 +00:00
|
|
|
"dt" 'haskell-debug/trace
|
|
|
|
|
2020-06-18 13:06:30 +00:00
|
|
|
"ri" 'spacemacs/haskell-format-imports)
|
|
|
|
(if (eq (spacemacs//haskell-backend) 'lsp)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"gl" 'haskell-navigate-imports
|
|
|
|
"S" 'haskell-mode-stylish-buffer
|
|
|
|
|
|
|
|
"hg" 'hoogle
|
|
|
|
"hG" 'haskell-hoogle-lookup-from-local)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"gi" 'haskell-navigate-imports
|
|
|
|
"F" 'haskell-mode-stylish-buffer
|
|
|
|
|
|
|
|
"hh" 'hoogle
|
|
|
|
"hG" 'haskell-hoogle-lookup-from-local)))
|
2015-02-22 11:03:46 +00:00
|
|
|
|
2016-05-18 06:24:39 +00:00
|
|
|
(evilified-state-evilify haskell-debug-mode haskell-debug-mode-map
|
|
|
|
"RET" 'haskell-debug/select
|
|
|
|
"a" 'haskell-debug/abandon
|
|
|
|
"b" 'haskell-debug/break-on-function
|
|
|
|
"c" 'haskell-debug/continue
|
|
|
|
"d" 'haskell-debug/delete
|
2017-02-12 18:02:55 +00:00
|
|
|
"i" 'haskell-debug/step
|
|
|
|
"s" 'haskell-debug/next
|
|
|
|
"S" 'haskell-debug/previous
|
2016-06-08 03:36:06 +00:00
|
|
|
"r" 'haskell-debug/refresh
|
2016-05-18 06:24:39 +00:00
|
|
|
"t" 'haskell-debug/trace)
|
|
|
|
|
2015-10-25 10:11:41 +00:00
|
|
|
;; configure C-c C-l so it doesn't throw any errors
|
2015-12-09 19:59:42 +00:00
|
|
|
(bind-key "C-c C-l" 'haskell-process-load-file haskell-mode-map)
|
2019-09-24 05:25:06 +00:00
|
|
|
(bind-key "C-c C-z" 'haskell-interactive-switch haskell-mode-map)
|
2015-10-25 10:11:41 +00:00
|
|
|
|
2014-12-21 16:03:27 +00:00
|
|
|
;; Switch back to editor from REPL
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'haskell-interactive-mode
|
2017-10-19 13:25:35 +00:00
|
|
|
"ss" 'haskell-interactive-switch-back)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'intero-repl-mode
|
|
|
|
"ss" 'intero-repl-switch-back)
|
2014-12-21 16:03:27 +00:00
|
|
|
|
|
|
|
;; Compile
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'haskell-cabal
|
|
|
|
"C" 'haskell-compile)
|
2014-12-21 16:03:27 +00:00
|
|
|
|
|
|
|
;; Cabal-file bindings
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'haskell-cabal-mode
|
|
|
|
;; "=" 'haskell-cabal-subsection-arrange-lines ;; Does a bad job, 'gg=G' works better
|
|
|
|
"d" 'haskell-cabal-add-dependency
|
|
|
|
"b" 'haskell-cabal-goto-benchmark-section
|
|
|
|
"e" 'haskell-cabal-goto-executable-section
|
|
|
|
"t" 'haskell-cabal-goto-test-suite-section
|
|
|
|
"m" 'haskell-cabal-goto-exposed-modules
|
|
|
|
"l" 'haskell-cabal-goto-library-section
|
|
|
|
"n" 'haskell-cabal-next-subsection
|
|
|
|
"p" 'haskell-cabal-previous-subsection
|
|
|
|
"sc" 'haskell-interactive-mode-clear
|
2017-10-19 13:25:35 +00:00
|
|
|
"sS" 'spacemacs/haskell-interactive-bring
|
|
|
|
"ss" 'haskell-interactive-switch
|
2015-11-18 00:38:05 +00:00
|
|
|
"N" 'haskell-cabal-next-section
|
|
|
|
"P" 'haskell-cabal-previous-section
|
|
|
|
"f" 'haskell-cabal-find-or-create-source-file)
|
2014-12-21 16:03:27 +00:00
|
|
|
|
2015-04-01 16:04:43 +00:00
|
|
|
;; Make "RET" behaviour in REPL saner
|
|
|
|
(evil-define-key 'insert haskell-interactive-mode-map
|
|
|
|
(kbd "RET") 'haskell-interactive-mode-return)
|
|
|
|
(evil-define-key 'normal haskell-interactive-mode-map
|
2016-06-10 16:53:07 +00:00
|
|
|
(kbd "RET") 'haskell-interactive-mode-return))
|
2015-05-10 12:08:11 +00:00
|
|
|
|
2019-08-02 19:33:15 +00:00
|
|
|
;; align rules for Haskell
|
|
|
|
(with-eval-after-load 'align
|
|
|
|
(add-to-list 'align-rules-list
|
|
|
|
'(haskell-types
|
|
|
|
(regexp . "\\(\\s-+\\)\\(::\\|∷\\)\\s-+")
|
|
|
|
(modes . haskell-modes)))
|
|
|
|
(add-to-list 'align-rules-list
|
|
|
|
'(haskell-assignment
|
|
|
|
(regexp . "\\(\\s-+\\)=\\s-+")
|
|
|
|
(modes . haskell-modes)))
|
|
|
|
(add-to-list 'align-rules-list
|
|
|
|
'(haskell-arrows
|
|
|
|
(regexp . "\\(\\s-+\\)\\(->\\|→\\)\\s-+")
|
|
|
|
(modes . haskell-modes)))
|
|
|
|
(add-to-list 'align-rules-list
|
|
|
|
'(haskell-left-arrows
|
|
|
|
(regexp . "\\(\\s-+\\)\\(<-\\|←\\)\\s-+")
|
|
|
|
(modes . haskell-modes))))))
|
2015-01-15 04:23:08 +00:00
|
|
|
|
2015-05-03 16:51:29 +00:00
|
|
|
(defun haskell/init-haskell-snippets ()
|
2015-05-04 04:27:13 +00:00
|
|
|
;; manually load the package since the current implementation is not lazy
|
|
|
|
;; loading friendly (funny coming from the haskell mode :-))
|
2017-01-17 05:20:59 +00:00
|
|
|
(setq haskell-snippets-dir
|
|
|
|
(configuration-layer/get-elpa-package-install-directory
|
|
|
|
'haskell-snippets))
|
2015-05-04 04:27:13 +00:00
|
|
|
|
|
|
|
(defun haskell-snippets-initialize ()
|
|
|
|
(let ((snip-dir (expand-file-name "snippets" haskell-snippets-dir)))
|
|
|
|
(add-to-list 'yas-snippet-dirs snip-dir t)
|
|
|
|
(yas-load-directory snip-dir)))
|
|
|
|
|
2015-09-29 05:07:57 +00:00
|
|
|
(with-eval-after-load 'yasnippet (haskell-snippets-initialize)))
|
2015-05-03 16:51:29 +00:00
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun haskell/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'haskell-mode))
|
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun haskell/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'haskell-mode))
|
|
|
|
|
2018-01-04 09:25:11 +00:00
|
|
|
|
2016-02-07 18:48:44 +00:00
|
|
|
;; doesn't support literate-haskell-mode :(
|
2015-04-03 21:12:56 +00:00
|
|
|
(defun haskell/init-hindent ()
|
|
|
|
(use-package hindent
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-04 09:25:11 +00:00
|
|
|
:if haskell-enable-hindent
|
2015-04-03 21:12:56 +00:00
|
|
|
:init
|
|
|
|
(add-hook 'haskell-mode-hook #'hindent-mode)
|
|
|
|
:config
|
|
|
|
(progn
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode
|
2018-01-04 09:25:11 +00:00
|
|
|
"f" 'hindent-reformat-decl-or-fill))))
|
2015-04-03 21:12:56 +00:00
|
|
|
|
2016-05-30 04:07:37 +00:00
|
|
|
(defun haskell/init-hlint-refactor ()
|
|
|
|
(use-package hlint-refactor
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-05-30 04:07:37 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode
|
|
|
|
"rb" 'hlint-refactor-refactor-buffer
|
|
|
|
"rr" 'hlint-refactor-refactor-at-point))))
|