summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/stylish_haskell.vim15
2 files changed, 20 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index ef287358..60de4a46 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -170,6 +170,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with brittany.',
\ },
+\ 'stylish-haskell': {
+\ 'function': 'ale#fixers#stylish_haskell#Fix',
+\ 'suggested_filetypes': ['haskell'],
+\ 'description': 'Refactor Haskell files with stylish-haskell.',
+\ },
\ 'refmt': {
\ 'function': 'ale#fixers#refmt#Fix',
\ 'suggested_filetypes': ['reason'],
diff --git a/autoload/ale/fixers/stylish_haskell.vim b/autoload/ale/fixers/stylish_haskell.vim
new file mode 100644
index 00000000..a352312f
--- /dev/null
+++ b/autoload/ale/fixers/stylish_haskell.vim
@@ -0,0 +1,15 @@
+" Author: eborden <evan@evan-borden.com>
+" Description: Integration of stylish-haskell formatting with ALE.
+"
+call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
+
+function! ale#fixers#stylish_haskell#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' --inplace'
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction