Skip to content

Honor equals on separate line after guards #1106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions haskell-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -795,15 +795,15 @@ parser. If parsing ends here, set indentation to left-indent."
(defun haskell-indentation-declaration ()
"Parse function or type declaration."
(haskell-indentation-separated #'haskell-indentation-expression "," nil)
(cond ((string= current-token "|")
(haskell-indentation-with-starter
(apply-partially #'haskell-indentation-separated
#'haskell-indentation-guard "|" nil)
nil))
((eq current-token 'end-tokens)
(when (member following-token '("|" "=" "::" ","))
(haskell-indentation-add-indentation current-indent)
(throw 'parse-end nil)))))
(when (string= current-token "|")
(haskell-indentation-with-starter
(apply-partially #'haskell-indentation-separated
#'haskell-indentation-guard "|" nil)
nil))
(when (eq current-token 'end-tokens)
(when (member following-token '("|" "=" "::" ","))
(haskell-indentation-add-indentation current-indent)
(throw 'parse-end nil))))

(defun haskell-indentation-layout (parser)
"Parse layout list, where each layout item is parsed by parser."
Expand Down
9 changes: 9 additions & 0 deletions tests/haskell-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,15 @@ fun = if | guard1 -> expr1
(2 9)
(3 0 11))

(hindent-test "54 equal after guards on separate line" "
foo x
| True
= X"
(1 0)
(2 2)
(3 2))


(ert-deftest haskell-indentation-ret-indents ()
(with-temp-switch-to-buffer
(haskell-mode)
Expand Down