+ enable lexical-scope everywhere (lexical-binding = t): ~5-10% faster startup; ~5-20% general boost + reduce consing, function calls & garbage collection by preferring cl-loop & dolist over lambda closures (for mapc[ar], add-hook, and various cl-lib filter/map/reduce functions) -- where possible + prefer functions with dedicated opcodes, like assq (see byte-defop's in bytecomp.el for more) + prefer pcase & cond (faster) over cl-case + general refactor for code readability + ensure naming & style conventions are adhered to + appease byte-compiler by marking unused variables with underscore + defer minor mode activation to after-init, emacs-startup or window-setup hooks; a customization opportunity for users + ensures custom functionality won't interfere with startup.
37 lines
1.1 KiB
EmacsLisp
37 lines
1.1 KiB
EmacsLisp
;;; lang/haskell/config.el -*- lexical-binding: t; -*-
|
|
|
|
(def-package! haskell-mode
|
|
:mode "\\.hs$"
|
|
:mode ("\\.ghci$" . ghci-script-mode)
|
|
:mode ("\\.cabal$" . haskell-cabal-mode)
|
|
:interpreter (("runghc" . haskell-mode)
|
|
("runhaskell" . haskell-mode))
|
|
:config
|
|
(load "haskell-mode-autoloads" nil t)
|
|
|
|
(set! :repl 'haskell-mode #'switch-to-haskell)
|
|
(push ".hi" completion-ignored-extensions)
|
|
|
|
(autoload 'switch-to-haskell "inf-haskell" nil t)
|
|
(after! inf-haskell
|
|
(map! :map inf-haskell-mode-map "ESC ESC" #'doom/popup-close)))
|
|
|
|
|
|
(def-package! dante
|
|
:after haskell-mode
|
|
:config
|
|
(if (executable-find "cabal")
|
|
(add-hook! 'haskell-mode-hook
|
|
#'(flycheck-mode dante-mode interactive-haskell-mode))
|
|
(warn "haskell-mode: couldn't find cabal")))
|
|
|
|
|
|
(def-package! company-ghc
|
|
:when (featurep! :completion company)
|
|
:after haskell-mode
|
|
:config
|
|
(set! :company-backend 'haskell-mode #'company-ghc)
|
|
(setq company-ghc-show-info 'oneline)
|
|
(if (executable-find "ghc-mod")
|
|
(add-hook 'haskell-mode-hook #'ghc-comp-init)
|
|
(warn "haskell-mode: couldn't find ghc-mode")))
|