@@ -519,6 +519,7 @@ indentation points to the right, we switch going to the left."
519
519
(" type" . haskell-indentation-data)
520
520
(" newtype" . haskell-indentation-data)
521
521
(" if" . haskell-indentation-if)
522
+ (" case" . haskell-indentation-case)
522
523
(" let" .
523
524
,(apply-partially 'haskell-indentation-phrase
524
525
'(haskell-indentation-declaration-layout
@@ -532,10 +533,6 @@ indentation points to the right, we switch going to the left."
532
533
(" rec" .
533
534
,(apply-partially 'haskell-indentation-with-starter
534
535
'haskell-indentation-expression-layout ))
535
- (" case" .
536
- ,(apply-partially 'haskell-indentation-phrase
537
- '(haskell-indentation-expression
538
- " of" haskell-indentation-case-layout)))
539
536
(" \\ " .
540
537
,(apply-partially 'haskell-indentation-with-starter
541
538
'haskell-indentation-lambda-maybe-lambdacase ))
@@ -576,7 +573,7 @@ indentation points to the right, we switch going to the left."
576
573
577
574
(defun haskell-indentation-case-layout ()
578
575
" Parse layout list with case expressions."
579
- (haskell-indentation-layout #'haskell-indentation-case ))
576
+ (haskell-indentation-layout #'haskell-indentation-case-item ))
580
577
581
578
(defun haskell-indentation-lambda-maybe-lambdacase ()
582
579
" Parse lambda or lambda-case expression.
@@ -759,7 +756,7 @@ Skip the keyword or parenthesis." ; FIXME: better description needed
759
756
((equal current-token end)
760
757
(haskell-indentation-read-next-token))))))
761
758
762
- (defun haskell-indentation-case-alternative ()
759
+ (defun haskell-indentation-case-item- alternative ()
763
760
" " ; FIXME
764
761
(setq left-indent (current-column ))
765
762
(haskell-indentation-separated #'haskell-indentation-expression " ," nil )
@@ -770,15 +767,15 @@ Skip the keyword or parenthesis." ; FIXME: better description needed
770
767
; ; otherwise fallthrough
771
768
))
772
769
773
- (defun haskell-indentation-case ()
770
+ (defun haskell-indentation-case-item ()
774
771
" " ; FIXME
775
772
(haskell-indentation-expression)
776
773
(cond ((eq current-token 'end-tokens )
777
774
(haskell-indentation-add-indentation current-indent))
778
775
((string= current-token " |" )
779
776
(haskell-indentation-with-starter
780
777
(apply-partially #'haskell-indentation-separated
781
- #'haskell-indentation-case-alternative " |" nil )
778
+ #'haskell-indentation-case-item- alternative " |" nil )
782
779
nil ))
783
780
((string= current-token " ->" )
784
781
(haskell-indentation-statement-right #'haskell-indentation-expression ))
@@ -953,14 +950,24 @@ layout starts."
953
950
(haskell-indentation-with-starter
954
951
(lambda ()
955
952
(haskell-indentation-separated
956
- #'haskell-indentation-case-alternative " |" nil ))
953
+ #'haskell-indentation-case-item- alternative " |" nil ))
957
954
nil )
958
955
(haskell-indentation-phrase-rest
959
956
'(haskell-indentation-expression
960
957
" then" haskell-indentation-expression
961
958
" else" haskell-indentation-expression))))
962
959
nil ))
963
960
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
+
964
971
(defun haskell-indentation-phrase (phrase )
965
972
" " ; FIXME
966
973
(haskell-indentation-with-starter
0 commit comments