@@ -519,6 +519,7 @@ indentation points to the right, we switch going to the left."
519519 (" type" . haskell-indentation-data)
520520 (" newtype" . haskell-indentation-data)
521521 (" if" . haskell-indentation-if)
522+ (" case" . haskell-indentation-case)
522523 (" let" .
523524 ,(apply-partially 'haskell-indentation-phrase
524525 '(haskell-indentation-declaration-layout
@@ -532,10 +533,6 @@ indentation points to the right, we switch going to the left."
532533 (" rec" .
533534 ,(apply-partially 'haskell-indentation-with-starter
534535 'haskell-indentation-expression-layout ))
535- (" case" .
536- ,(apply-partially 'haskell-indentation-phrase
537- '(haskell-indentation-expression
538- " of" haskell-indentation-case-layout)))
539536 (" \\ " .
540537 ,(apply-partially 'haskell-indentation-with-starter
541538 'haskell-indentation-lambda-maybe-lambdacase ))
@@ -576,7 +573,7 @@ indentation points to the right, we switch going to the left."
576573
577574(defun haskell-indentation-case-layout ()
578575 " Parse layout list with case expressions."
579- (haskell-indentation-layout #'haskell-indentation-case ))
576+ (haskell-indentation-layout #'haskell-indentation-case-item ))
580577
581578(defun haskell-indentation-lambda-maybe-lambdacase ()
582579 " Parse lambda or lambda-case expression.
@@ -759,7 +756,7 @@ Skip the keyword or parenthesis." ; FIXME: better description needed
759756 ((equal current-token end)
760757 (haskell-indentation-read-next-token))))))
761758
762- (defun haskell-indentation-case-alternative ()
759+ (defun haskell-indentation-case-item- alternative ()
763760 " " ; FIXME
764761 (setq left-indent (current-column ))
765762 (haskell-indentation-separated #'haskell-indentation-expression " ," nil )
@@ -770,15 +767,15 @@ Skip the keyword or parenthesis." ; FIXME: better description needed
770767 ; ; otherwise fallthrough
771768 ))
772769
773- (defun haskell-indentation-case ()
770+ (defun haskell-indentation-case-item ()
774771 " " ; FIXME
775772 (haskell-indentation-expression)
776773 (cond ((eq current-token 'end-tokens )
777774 (haskell-indentation-add-indentation current-indent))
778775 ((string= current-token " |" )
779776 (haskell-indentation-with-starter
780777 (apply-partially #'haskell-indentation-separated
781- #'haskell-indentation-case-alternative " |" nil )
778+ #'haskell-indentation-case-item- alternative " |" nil )
782779 nil ))
783780 ((string= current-token " ->" )
784781 (haskell-indentation-statement-right #'haskell-indentation-expression ))
@@ -953,14 +950,24 @@ layout starts."
953950 (haskell-indentation-with-starter
954951 (lambda ()
955952 (haskell-indentation-separated
956- #'haskell-indentation-case-alternative " |" nil ))
953+ #'haskell-indentation-case-item- alternative " |" nil ))
957954 nil )
958955 (haskell-indentation-phrase-rest
959956 '(haskell-indentation-expression
960957 " then" haskell-indentation-expression
961958 " else" haskell-indentation-expression))))
962959 nil ))
963960
961+ (defun haskell-indentation-case ()
962+ " " ; FIXME
963+ (haskell-indentation-with-starter
964+ (lambda ()
965+ (haskell-indentation-expression)
966+ (when (string= current-token " of" )
967+ (haskell-indentation-with-starter
968+ #'haskell-indentation-case-layout )))
969+ nil ))
970+
964971(defun haskell-indentation-phrase (phrase )
965972 " " ; FIXME
966973 (haskell-indentation-with-starter
0 commit comments