Skip to content
Create a gist now

Instantly share code, notes, and snippets.

(require 'util)
(require 'flycheck)
(require 'evil-leader)
;;; Code:
(add-to-list 'exec-path "~/.cabal/bin/")
(add-to-list 'exec-path "~/Library/Haskell/current/bin/")
(install-and-require #'haskell-mode)
(install-and-require #'ghc)
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(setq haskell-program-name "~/Library/Haskell/current/bin/ghci")
(load-and-use #'hsenv)
(autoload 'ghc-init "ghc" nil t)
(add-hook 'haskell-mode-hook (lambda () (ghc-init)))
(ac-define-source ghc-mod
'((depends ghc)
(candidates . (ghc-select-completion-symbol))
(symbol . "s")
(document . haskell-doc-sym-doc)
(defun haskell-autocomplete ()
(setq ac-sources (list 'ac-source-ghc-mod
(add-hook 'haskell-mode-hook 'haskell-autocomplete)
(flycheck-declare-checker haskell-hlint
"A Haskell syntax and style checker using hlint.
See URL `'."
:command '("hlint" source-inplace)
'(("^\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): Warning: \\(?4:.*\\(\n.+\\)+\\)" warning)
("^\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): Error: \\(?4:.*\\(\n.+\\)+\\)" error))
:modes 'haskell-mode)
(push 'haskell-hlint flycheck-checkers)
(flycheck-define-checker haskell-hdevtools
"A Haskell syntax and type checker using hdevtools.
See URL `'."
:command ("hdevtools" "check" "-g" "-Wall" source-inplace)
((warning line-start (file-name) ":" line ":" column ":"
(or " " "\n ") "Warning:" (optional "\n")
(one-or-more " ")
(message (one-or-more not-newline)
(zero-or-more "\n"
(one-or-more " ")
(one-or-more not-newline)))
(error line-start (file-name) ":" line ":" column ":"
(or (message (one-or-more not-newline))
(and "\n" (one-or-more " ")
(message (one-or-more not-newline)
(zero-or-more "\n"
(one-or-more " ")
(one-or-more not-newline)))))
:modes haskell-mode
:next-checkers (haskell-hlint))
(push 'haskell-hdevtools flycheck-checkers)
(evil-leader/set-key-for-mode 'haskell-mode
"h" 'haskell-hayoo
"c b" 'inferior-haskell-load-file)
(provide 'haskell-conf)
;;; haskell-conf.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.