Skip to content

Commit 6059ea6

Browse files
authored
Merge pull request #1400 from gracjan/pr-implication
Support => as proper keyword
2 parents f30b773 + 59ba435 commit 6059ea6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

haskell-indentation.el

+10-8
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ and indent when all of the following are true:
530530
`(("::" .
531531
,(apply-partially 'haskell-indentation-with-starter
532532
(apply-partially 'haskell-indentation-separated
533-
'haskell-indentation-type "->")))
533+
'haskell-indentation-type '("->" "=>"))))
534534
("(" .
535535
,(apply-partially 'haskell-indentation-list
536536
'haskell-indentation-type ")" ","))
@@ -651,14 +651,16 @@ After a lambda (backslash) there are two possible cases:
651651
(catch 'return
652652
(while t
653653
(cond
654-
((member current-token '(value operator "->"))
654+
((member current-token '(value operator "->" "=>"))
655655
(haskell-indentation-read-next-token))
656656

657657
((eq current-token 'end-tokens)
658658
(when (member following-token
659659
'(value operator no-following-token
660660
"(" "[" "{" "::"))
661-
(haskell-indentation-add-indentation current-indent)
661+
(if (equal following-token "=>")
662+
(haskell-indentation-add-indentation starter-indent)
663+
(haskell-indentation-add-indentation current-indent))
662664
(haskell-indentation-add-indentation left-indent))
663665
(throw 'return nil))
664666
(t (let ((parser (assoc current-token haskell-indentation-type-list)))
@@ -671,13 +673,13 @@ After a lambda (backslash) there are two possible cases:
671673
(let ((current-indent (current-column)))
672674
(catch 'return
673675
(cond
674-
((member current-token '(value operator "->"))
676+
((member current-token '(value operator "->" "=>"))
675677
(haskell-indentation-read-next-token))
676678

677679
((eq current-token 'end-tokens)
678680
(when (member following-token
679681
'(value operator no-following-token
680-
"->" "(" "[" "{" "::"))
682+
"->" "=>" "(" "[" "{" "::"))
681683
(haskell-indentation-add-indentation current-indent))
682684
(throw 'return nil))
683685
(t (let ((parser (assoc current-token haskell-indentation-type-list)))
@@ -692,7 +694,7 @@ For example
692694
let x :: Int = 12
693695
do x :: Int <- return 12"
694696
(haskell-indentation-with-starter
695-
(apply-partially #'haskell-indentation-separated #'haskell-indentation-type "->"))
697+
(apply-partially #'haskell-indentation-separated #'haskell-indentation-type '("->" "=>")))
696698
(when (member current-token '("<-" "="))
697699
(haskell-indentation-statement-right #'haskell-indentation-expression)))
698700

@@ -1206,9 +1208,9 @@ line."
12061208
(match-string-no-properties 1))
12071209
((looking-at "[][(){}[,;]")
12081210
(match-string-no-properties 0))
1209-
((looking-at "\\(\\\\\\|->\\|<-\\|::\\|=\\||\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
1211+
((looking-at "\\(\\\\\\|->\\|<-\\|::\\|=\\||\\|=>\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
12101212
(match-string-no-properties 1))
1211-
((looking-at "\\(→\\|←\\|∷\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
1213+
((looking-at "\\(→\\|←\\|∷\\|⇒\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
12121214
(let ((tok (match-string-no-properties 1)))
12131215
(or (cdr (assoc tok haskell-indentation-unicode-tokens)) tok)))
12141216
((looking-at"[-:!#$%&*+./<=>?@\\\\^|~`]" )

0 commit comments

Comments
 (0)