Skip to content

Commit 76d481a

Browse files
committed
Merge pull request #1105 from gracjan/pr-data-equals-separate-line
Honor equals on its own line in data decl
2 parents ffeab32 + baa12c4 commit 76d481a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

haskell-indentation.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,11 @@ For example
643643
(when (string= current-token "instance")
644644
(haskell-indentation-read-next-token))
645645
(haskell-indentation-type)
646-
(cond ((string= current-token "=")
646+
(cond ((eq current-token 'end-tokens)
647+
(when (member following-token '("=" "where"))
648+
(haskell-indentation-add-indentation current-indent)
649+
(throw 'parse-end nil)))
650+
((string= current-token "=")
647651
(haskell-indentation-separated
648652
#'haskell-indentation-expression "|" "deriving"))
649653
((string= current-token "where")

tests/haskell-indentation-tests.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ data X = X
308308
(2 0 2)
309309
(3 0))
310310

311+
(hindent-test "13b honour = on a separate line in data declaration" "
312+
data X a b
313+
= X"
314+
(1 0)
315+
(2 2))
316+
311317
(hindent-test "14* Line starting with operator inside \"do\" needs to be indented""
312318
fun = do
313319
pure X

0 commit comments

Comments
 (0)