Function: haskell-font-lock--forward-type
haskell-font-lock--forward-type is an interactive and natively
compiled function defined in haskell-font-lock.el.
Signature
(haskell-font-lock--forward-type &optional IGNORE)
Documentation
Find where does this type declaration end.
Moves the point to the end of type declaration. It should be invoked with point just after one of type introducing keywords like ::, class, instance, data, newtype, type.
Key Bindings
This command is not in any keymaps.
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--forward-type (&optional ignore)
"Find where does this type declaration end.
Moves the point to the end of type declaration. It should be
invoked with point just after one of type introducing keywords
like ::, class, instance, data, newtype, type."
(interactive)
(let ((cont t)
(end (point))
(token nil)
;; we are starting right after ::
(last-token-was-operator t)
(last-token-was-newline nil)
(open-parens 0))
(while cont
(setq token (haskell-lexeme-looking-at-token 'newline))
(cond
((null token)
(setq cont nil))
((member token '(newline))
(setq last-token-was-newline (not last-token-was-operator))
(setq end (match-end 0))
(goto-char (match-end 0)))
((member (match-string-no-properties 0)
'(")" "]" "}"))
(setq open-parens (1- open-parens))
(if (< open-parens 0)
;; unmatched closing parenthesis closes type declaration
(setq cont nil)
(setq end (match-end 0))
(goto-char end))
(setq last-token-was-newline nil))
((and (member (match-string-no-properties 0)
'("," ";" "|"))
(not (member (match-string-no-properties 0) ignore)))
(if (equal 0 open-parens)
(setq cont nil)
(setq last-token-was-operator t)
(setq end (match-end 0))
(goto-char end))
(setq last-token-was-newline nil))
((and (or (member (match-string-no-properties 0)
'("<-" "=" "←"))
(member (match-string-no-properties 0) haskell-font-lock-keywords))
(not (member (match-string-no-properties 0) ignore)))
(setq cont nil)
(setq last-token-was-newline nil))
((member (match-string-no-properties 0)
'("(" "[" "{"))
(if last-token-was-newline
(setq cont nil)
(setq open-parens (1+ open-parens))
(setq end (match-end 0))
(goto-char end)
(setq last-token-was-newline nil)))
((member token '(qsymid char string number template-haskell-quote template-haskell-quasi-quote))
(setq last-token-was-operator (member (haskell-lexeme-classify-by-first-char (char-after (match-beginning 1)))
'(varsym consym)))
(if (and (not last-token-was-operator) last-token-was-newline)
(setq cont nil)
(goto-char (match-end 0))
(setq end (point)))
(setq last-token-was-newline nil))
((member token '(comment nested-comment literate-comment))
(goto-char (match-end 0))
(setq end (point)))
(t
(goto-char (match-end 0))
(setq end (point))
(setq last-token-was-newline nil))))
(goto-char end)))