diff --git a/haskell-indentation.el b/haskell-indentation.el index b07167159..d0335d774 100644 --- a/haskell-indentation.el +++ b/haskell-indentation.el @@ -643,7 +643,11 @@ For example (when (string= current-token "instance") (haskell-indentation-read-next-token)) (haskell-indentation-type) - (cond ((string= current-token "=") + (cond ((eq current-token 'end-tokens) + (when (member following-token '("=" "where")) + (haskell-indentation-add-indentation current-indent) + (throw 'parse-end nil))) + ((string= current-token "=") (haskell-indentation-separated #'haskell-indentation-expression "|" "deriving")) ((string= current-token "where") diff --git a/tests/haskell-indentation-tests.el b/tests/haskell-indentation-tests.el index fb4255fe5..c34aca7cc 100644 --- a/tests/haskell-indentation-tests.el +++ b/tests/haskell-indentation-tests.el @@ -308,6 +308,12 @@ data X = X (2 0 2) (3 0)) +(hindent-test "13b honour = on a separate line in data declaration" " +data X a b + = X" + (1 0) + (2 2)) + (hindent-test "14* Line starting with operator inside \"do\" needs to be indented"" fun = do pure X