Function: haskell-font-lock--select-face-on-type-or-constructor
haskell-font-lock--select-face-on-type-or-constructor is a natively
compiled function defined in haskell-font-lock.el.
Signature
(haskell-font-lock--select-face-on-type-or-constructor)
Documentation
Private function used to select either type or constructor face on an uppercase identifier.
Source Code
;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-font-lock.el
(defun haskell-font-lock--select-face-on-type-or-constructor ()
"Private function used to select either type or constructor face
on an uppercase identifier."
(cl-case (haskell-lexeme-classify-by-first-char (char-after (match-beginning 1)))
(varid (let ((word (match-string-no-properties 0)))
(cond
((member word haskell-font-lock-keywords)
;; Note: keywords parse as keywords only when not qualified.
;; GHC parses Control.let as a single but illegal lexeme.
(when (member word '("class" "instance" "type" "data" "newtype"))
(save-excursion
(goto-char (match-end 0))
(save-match-data
(haskell-font-lock--forward-type
(cond
((member word '("class" "instance"))
'("|"))
((member word '("type"))
;; Need to support 'type instance'
'("=" "instance")))))
(add-text-properties (match-end 0) (point) '(font-lock-multiline t haskell-type t))))
'haskell-keyword-face)
((member word '("forall"))
(when (get-text-property (match-beginning 0) 'haskell-type)
'haskell-keyword-face)))))
(conid (if (get-text-property (match-beginning 0) 'haskell-type)
'haskell-type-face
'haskell-constructor-face))
(varsym (unless (and (member (match-string 0) '("-" "+" "."))
(equal (string-to-syntax "w") (syntax-after (match-beginning 0))))
;; We need to protect against the case of
;; plus, minus or dot inside a floating
;; point number.
'haskell-operator-face))
(consym (if (not (member (match-string 1) '("::" "∷")))
(if (get-text-property (match-beginning 0) 'haskell-type)
'haskell-type-face
'haskell-constructor-face)
(save-excursion
(goto-char (match-end 0))
(save-match-data
(haskell-font-lock--forward-type))
(add-text-properties (match-end 0) (point) '(font-lock-multiline t haskell-type t)))
'haskell-operator-face))))