Function: haskell-indentation-with-starter
haskell-indentation-with-starter is a natively compiled function
defined in haskell-indentation.el.
Signature
(haskell-indentation-with-starter PARSER &optional END WHERE-EXPR?)
Documentation
Parse an expression starting with a keyword or parenthesis.
Skip the keyword or parenthesis.
Source Code
;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-indentation.el
(defun haskell-indentation-with-starter (parser &optional end where-expr?)
"Parse an expression starting with a keyword or parenthesis.
Skip the keyword or parenthesis." ; FIXME: better description needed
(let ((starter-column (current-column))
(current-indent current-indent)
(left-indent
(if (= (current-column) (haskell-indentation-current-indentation))
(current-column)
left-indent)))
(haskell-indentation-read-next-token)
(when (eq current-token 'end-tokens)
(cond ((equal following-token end)
;; indent before keyword or parenthesis
(haskell-indentation-add-indentation starter-column))
(where-expr?
;; left indent + where post indent
(haskell-indentation-add-where-post-indent left-indent))
(t
(haskell-indentation-add-left-indent)))
(throw 'parse-end nil))
(let* ((current-indent (current-column))
(starter-indent (min starter-column current-indent))
(left-indent
(if end
(+ starter-indent haskell-indentation-starter-offset)
left-indent)))
(funcall parser)
(cond ((eq current-token 'end-tokens)
(when (equal following-token end)
;; indent before keyword or parenthesis
(haskell-indentation-add-indentation starter-indent))
;; add no more indentations if we expect a closing keyword
(when end
(throw 'parse-end nil)))
((equal current-token end)
(haskell-indentation-read-next-token))))))