Skip to content

Commit 6df1bc0

Browse files
committed
Revert "Handle case expressions properly"
This reverts commit 6feda23.
1 parent cff017b commit 6df1bc0

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

haskell-indentation.el

+9-16
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,6 @@ fixes up only indentation."
520520
("type" . haskell-indentation-data)
521521
("newtype" . haskell-indentation-data)
522522
("if" . haskell-indentation-if)
523-
("case" . haskell-indentation-case)
524523
("let" .
525524
,(apply-partially 'haskell-indentation-phrase
526525
'(haskell-indentation-declaration-layout
@@ -534,6 +533,10 @@ fixes up only indentation."
534533
("rec" .
535534
,(apply-partially 'haskell-indentation-with-starter
536535
'haskell-indentation-expression-layout))
536+
("case" .
537+
,(apply-partially 'haskell-indentation-phrase
538+
'(haskell-indentation-expression
539+
"of" haskell-indentation-case-layout)))
537540
("\\" .
538541
,(apply-partially 'haskell-indentation-with-starter
539542
'haskell-indentation-lambda-maybe-lambdacase))
@@ -574,7 +577,7 @@ fixes up only indentation."
574577

575578
(defun haskell-indentation-case-layout ()
576579
"Parse layout list with case expressions."
577-
(haskell-indentation-layout #'haskell-indentation-case-item))
580+
(haskell-indentation-layout #'haskell-indentation-case))
578581

579582
(defun haskell-indentation-lambda-maybe-lambdacase ()
580583
"Parse lambda or lambda-case expression.
@@ -761,7 +764,7 @@ Skip the keyword or parenthesis." ; FIXME: better description needed
761764
((equal current-token end)
762765
(haskell-indentation-read-next-token))))))
763766

764-
(defun haskell-indentation-case-item-alternative ()
767+
(defun haskell-indentation-case-alternative ()
765768
"" ; FIXME
766769
(setq left-indent (current-column))
767770
(haskell-indentation-separated #'haskell-indentation-expression "," nil)
@@ -772,15 +775,15 @@ Skip the keyword or parenthesis." ; FIXME: better description needed
772775
;; otherwise fallthrough
773776
))
774777

775-
(defun haskell-indentation-case-item ()
778+
(defun haskell-indentation-case ()
776779
"" ; FIXME
777780
(haskell-indentation-expression)
778781
(cond ((eq current-token 'end-tokens)
779782
(haskell-indentation-add-indentation current-indent))
780783
((string= current-token "|")
781784
(haskell-indentation-with-starter
782785
(apply-partially #'haskell-indentation-separated
783-
#'haskell-indentation-case-item-alternative "|" nil)
786+
#'haskell-indentation-case-alternative "|" nil)
784787
nil))
785788
((string= current-token "->")
786789
(haskell-indentation-statement-right #'haskell-indentation-expression))
@@ -957,24 +960,14 @@ layout starts."
957960
(haskell-indentation-with-starter
958961
(lambda ()
959962
(haskell-indentation-separated
960-
#'haskell-indentation-case-item-alternative "|" nil))
963+
#'haskell-indentation-case-alternative "|" nil))
961964
nil)
962965
(haskell-indentation-phrase-rest
963966
'(haskell-indentation-expression
964967
"then" haskell-indentation-expression
965968
"else" haskell-indentation-expression))))
966969
nil))
967970

968-
(defun haskell-indentation-case ()
969-
"" ; FIXME
970-
(haskell-indentation-with-starter
971-
(lambda ()
972-
(haskell-indentation-expression)
973-
(when (string= current-token "of")
974-
(haskell-indentation-with-starter
975-
#'haskell-indentation-case-layout)))
976-
nil))
977-
978971
(defun haskell-indentation-phrase (phrase)
979972
"" ; FIXME
980973
(haskell-indentation-with-starter

0 commit comments

Comments
 (0)