Function: haskell-cabal-add-dependency

haskell-cabal-add-dependency is an interactive and natively compiled function defined in haskell-cabal.el.

Signature

(haskell-cabal-add-dependency PACKAGE &optional VERSION NO-PROMPT SORT SILENT)

Documentation

Add PACKAGE to the cabal file.

If VERSION is non-nil it will be appended as a minimum version. If NO-PROMPT is nil the minimum package version is read from the minibuffer. When SORT is non-nil the package entries are sorted afterwards. If SILENT is non-nil the user is prompted for each source-section.

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-cabal.el
(defun haskell-cabal-add-dependency
    (package &optional version no-prompt sort silent)
  "Add PACKAGE to the cabal file.
If VERSION is non-nil it will be appended as a minimum version.
If NO-PROMPT is nil the minimum package version is read from the
minibuffer.  When SORT is non-nil the package entries are sorted
afterwards.  If SILENT is non-nil the user is prompted for each
source-section."
  (interactive
   (list (read-from-minibuffer "Package entry: ") nil t t nil))
  (haskell-mode-toggle-interactive-prompt-state)
  (unwind-protect
      (save-window-excursion
        (find-file-other-window (haskell-cabal-find-file))
        (let ((entry (if no-prompt package
                       (read-from-minibuffer
                        "Package entry: "
                        (concat package
                                (if version (concat " >= " version) ""))))))
          (haskell-cabal-add-build-dependency entry sort silent)
          (when (or silent (y-or-n-p "Save cabal file? "))
            (save-buffer))))
    ;; unwind
    (haskell-mode-toggle-interactive-prompt-state t)))