-
Notifications
You must be signed in to change notification settings - Fork 6
/
flycheck-hdevtools.el
87 lines (69 loc) · 2.92 KB
/
flycheck-hdevtools.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
;;; flycheck-hdevtools.el --- A flycheck checker for Haskell using hdevtools
;; Copyright (C) 2013-2014 Steve Purcell
;; Author: Steve Purcell <steve@sanityinc.com>
;; URL: https://github.com/flycheck/flycheck-hdevtools
;; Keywords: convenience languages tools
;; Package-Requires: ((flycheck "0.21-cvs1") (dash "2.0"))
;; Version: DEV
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Adds a Flycheck syntax checker for Haskell based on hdevtools.
;;;; Setup
;; (eval-after-load 'flycheck '(require 'flycheck-hdevtools))
;;; Code:
(require 'dash)
(require 'flycheck)
(flycheck-define-checker haskell-hdevtools
"A Haskell syntax and type checker using hdevtools.
See URL `https://github.com/hdevtools/hdevtools'."
:command
("hdevtools" "check" "-g" "-Wall"
(eval (when flycheck-ghc-no-user-package-database
(list "-g" "-no-user-package-db")))
(eval (apply #'append (mapcar (lambda (db) (concat "-g-package-db" db))
flycheck-ghc-package-databases)))
(eval (concat
"-g-i"
(flycheck-module-root-directory
(flycheck-find-in-buffer flycheck-haskell-module-re))))
(eval (apply #'append (mapcar (lambda (db) (list (concat "-g-i" db)))
flycheck-ghc-search-path)))
source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ":"
(or " " "\n ") "warning:" (optional "\n")
(message
(one-or-more " ") (one-or-more not-newline)
(zero-or-more "\n"
(one-or-more " ")
(one-or-more not-newline)))
line-end)
(error line-start (file-name) ":" line ":" column ":"
(or " " "\n ") "error:" (optional "\n")
(message
(one-or-more " ") (one-or-more not-newline)
(zero-or-more "\n"
(one-or-more " ")
(one-or-more not-newline)))
line-end)
)
:error-filter
(lambda (errors)
(-> errors
flycheck-dedent-error-messages
flycheck-sanitize-errors))
:modes haskell-mode
:next-checkers ((warning . haskell-hlint)))
(add-to-list 'flycheck-checkers 'haskell-hdevtools)
(provide 'flycheck-hdevtools)
;;; flycheck-hdevtools.el ends here