Skip to content

add support to indent and align guard and rhs for unicode haskell #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion haskell-align-imports.el
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
"Are we after the imports list?"
(save-excursion
(goto-char (line-beginning-position))
(not (not (search-forward-regexp "\\( = \\|\\<instance\\>\\| :: \\)"
(not (not (search-forward-regexp "\\( = \\|\\<instance\\>\\| :: \\| ∷ \\)"
(line-end-position) t 1)))))

(provide 'haskell-align-imports)
Expand Down
2 changes: 1 addition & 1 deletion haskell-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Returns keywords suitable for `font-lock-keywords'."
(concat "\\S_"
;; (regexp-opt '(".." "::" "=" "\\" "|" "<-" "->"
;; "@" "~" "=>") t)
"\\(->\\|\\.\\.\\|::\\|∷\\|<-\\|=>\\|[=@\\|~]\\)"
"\\(->\\|→\\|\\.\\.\\|::\\|∷\\|<-\\|←\\|=>\\|[=@\\|~]\\)"
"\\S_"))
;; Reserved identifiers
(reservedid
Expand Down
2 changes: 1 addition & 1 deletion haskell-indent.el
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Returns the location of the start of the comment, nil otherwise."
((looking-at "\\(\\([[:alpha:]]\\(\\sw\\|'\\)*\\)\\|_\\)[ \t\n]*")
'ident)
((looking-at "\\(|[^|]\\)[ \t\n]*") 'guard)
((looking-at "\\(=[^>=]\\|::\\|->\\|<-\\)[ \t\n]*") 'rhs)
((looking-at "\\(=[^>=]\\|::\\|∷\\|→\\|←\\|->\\|<-\\)[ \t\n]*") 'rhs)
(t 'other)))

(defvar haskell-indent-current-line-first-ident ""
Expand Down
2 changes: 1 addition & 1 deletion haskell-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ Preserves indentation and removes extra whitespace"
(match-string-no-properties 1))
((looking-at "[][(){}[,;]")
(match-string-no-properties 0))
((looking-at "\\(\\\\\\|->\\|<-\\|::\\|=\\||\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
((looking-at "\\(\\\\\\|->\\|→\\|<-\\|←\\|::\\|∷\\|=\\||\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
(match-string-no-properties 1))
((looking-at "\\(→\\|←\\|∷\\)\\([^-:!#$%&*+./<=>?@\\\\^|~]\\|$\\)")
(let ((tok (match-string-no-properties 1)))
Expand Down
1 change: 1 addition & 0 deletions haskell-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
(require 'haskell-string)
(with-no-warnings (require 'cl))


;; FIXME: code-smell: too many forward decls for haskell-session are required here
(defvar haskell-session)
(declare-function haskell-process "haskell-process" ())
Expand Down
4 changes: 2 additions & 2 deletions inf-haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ The returned info is cached for reuse by `haskell-doc-mode'."
(if (string-match "\\`\\s_+\\'" expr) (setq expr (concat "(" expr ")")))
(let ((type (inferior-haskell-get-result (concat ":type " expr))))
(if (not (string-match (concat "^\\(" (regexp-quote expr)
"[ \t\n]+::[ \t\n]*\\(.\\|\n\\)*\\)")
"[ \t\n]+\\(::\\|∷\\)[ \t\n]*\\(.\\|\n\\)*\\)")
type))
(error "No type info: %s" type)
(progn
Expand All @@ -506,7 +506,7 @@ The returned info is cached for reuse by `haskell-doc-mode'."
(when (and (boundp 'haskell-doc-mode) haskell-doc-mode
(boundp 'haskell-doc-user-defined-ids)
;; Haskell-doc only works for idents, not arbitrary expr.
(string-match "\\`(?\\(\\s_+\\|\\(\\sw\\|\\s'\\)+\\)?[ \t]*::[ \t]*"
(string-match "\\`(?\\(\\s_+\\|\\(\\sw\\|\\s'\\)+\\)?[ \t]*\\(::\\|∷\\)[ \t]*"
type))
(let ((sym (match-string 1 type)))
(setq haskell-doc-user-defined-ids
Expand Down