summaryrefslogtreecommitdiff
path: root/ale_linters/haskell
diff options
context:
space:
mode:
authorEric Wolf <ericwolf42@gmail.com>2018-07-20 16:30:16 +0200
committererwo <erwo@abas.de>2018-07-20 16:48:27 +0200
commitac6bc6d0ae279c70081cba4225de2df54688757d (patch)
tree0d9c782d9263a2474f5fdb747d49793fc9e837ff /ale_linters/haskell
parent61a5880747128dbf988a076e190ccb346500b5ff (diff)
downloadale-ac6bc6d0ae279c70081cba4225de2df54688757d.zip
Add cabal-ghc linter
cabal-ghc calls ghc via cabal exec and so ghc has access to packages in cabal sandboxes for example
Diffstat (limited to 'ale_linters/haskell')
-rw-r--r--ale_linters/haskell/cabal_ghc.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/ale_linters/haskell/cabal_ghc.vim b/ale_linters/haskell/cabal_ghc.vim
new file mode 100644
index 00000000..79fd8ff9
--- /dev/null
+++ b/ale_linters/haskell/cabal_ghc.vim
@@ -0,0 +1,18 @@
+" Author: Eric Wolf <ericwolf42@gmail.com>
+" Description: ghc for Haskell files called with cabal exec
+
+call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
+
+function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
+ return 'cabal exec -- ghc '
+ \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
+ \ . ' %t'
+endfunction
+
+call ale#linter#Define('haskell', {
+\ 'name': 'cabal-ghc',
+\ 'output_stream': 'stderr',
+\ 'executable': 'cabal',
+\ 'command_callback': 'ale_linters#haskell#cabal_ghc#GetCommand',
+\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
+\})