diff --git a/modules/lang/haskell/+dante.el b/modules/lang/haskell/+dante.el new file mode 100644 index 000000000..45ca105ab --- /dev/null +++ b/modules/lang/haskell/+dante.el @@ -0,0 +1,13 @@ +;;; lang/haskell/+dante.el -*- lexical-binding: t; -*- + +(def-package! dante + :after haskell-mode + :init + (add-hook! 'haskell-mode-hook #'(dante-mode interactive-haskell-mode)) + :config + (unless (executable-find "cabal") + (warn "haskell-mode: couldn't find cabal") + (remove-hook 'haskell-mode-hook #'dante-mode)) + + (add-hook 'dante-mode-hook #'flycheck-mode)) + diff --git a/modules/lang/haskell/+intero.el b/modules/lang/haskell/+intero.el new file mode 100644 index 000000000..a27ab768c --- /dev/null +++ b/modules/lang/haskell/+intero.el @@ -0,0 +1,21 @@ +;;; lang/haskell/+intero.el -*- lexical-binding: t; -*- + +(def-package! intero + :commands intero-mode + :init + (add-hook 'haskell-mode-hook #'intero-mode) + :config + (unless (executable-find "stack") + (warn "haskell-mode: couldn't find stack, disabling intero") + (remove-hook 'haskell-mode-hook #'intero-mode)) + + (add-hook! 'intero-mode-hook #'(flycheck-mode eldoc-mode)) + + (set! :popup "^intero:backend:" :regex t :size 12) + (set! :jump :definition #'intero-goto-definition)) + + +(def-package! hindent + :commands hindent-mode + :init + (add-hook 'haskell-mode-hook #'hindent-mode)) diff --git a/modules/lang/haskell/config.el b/modules/lang/haskell/config.el index 17e344f65..b634ecc82 100644 --- a/modules/lang/haskell/config.el +++ b/modules/lang/haskell/config.el @@ -17,21 +17,21 @@ (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 + :init + (add-hook 'haskell-mode-hook #'ghc-comp-init) :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"))) + (set! :company-backend 'haskell-mode #'company-ghc) + (warn "haskell-mode: couldn't find ghc-mode") + (remove-hook 'haskell-mode-hook #'ghc-comp-init)) + + (setq company-ghc-show-info 'oneline)) + + +;; +(if (featurep! +dante) + (load! +dante) + (load! +intero)) diff --git a/modules/lang/haskell/packages.el b/modules/lang/haskell/packages.el index 666cd7127..981d218f8 100644 --- a/modules/lang/haskell/packages.el +++ b/modules/lang/haskell/packages.el @@ -2,7 +2,13 @@ ;;; lang/haskell/packages.el (package! haskell-mode) -(package! dante) - (when (featurep! :completion company) (package! company-ghc)) + +;; +(cond ((featurep! +dante) + (package! dante)) + (t + (package! intero) + (package! hindent))) +