Skip to content
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