Function: haskell-update-ghc-support
haskell-update-ghc-support is an interactive and natively compiled
function defined in haskell-ghc-support.el.
Signature
(haskell-update-ghc-support GHC-PATH)
Documentation
Update haskell-ghc-supported-options and haskell-ghc-supported-extensions.
This command should be run once a GHC is released. It will use
--show-options and --supported-extensions to source the
information from GHC-PATH. Then it will update source code to
include newly found options. Old options are never removed and
are retained to support old versions of the compiler.
Options and extension are kept in ascending order.
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-ghc-support.el
(defun haskell-update-ghc-support (ghc-path)
"Update `haskell-ghc-supported-options' and `haskell-ghc-supported-extensions'.
This command should be run once a GHC is released. It will use
--show-options and --supported-extensions to source the
information from GHC-PATH. Then it will update source code to
include newly found options. Old options are never removed and
are retained to support old versions of the compiler.
Options and extension are kept in ascending order."
(interactive
(list
(read-shell-command "GHC command: " nil nil
(let ((filename
(cond
(buffer-file-name)
((eq major-mode 'dired-mode)
(when (fboundp 'dired-get-filename)
;; silence the checker
(dired-get-filename nil t))))))
(and filename (file-relative-name filename))))))
(let ((extentions (split-string (shell-command-to-string (concat ghc-path " --supported-extensions"))))
(options (split-string (shell-command-to-string (concat ghc-path " --show-options")))))
(with-current-buffer
(find-file-noselect (replace-regexp-in-string "\\.elc$" ".el" (symbol-file 'haskell-ghc-supported-options)))
(save-excursion
(goto-char (point-min))
(re-search-forward "BEGIN haskell-ghc-supported-extensions")
(forward-line 1)
(let ((point (point)))
(re-search-forward "END haskell-ghc-supported-extensions")
(goto-char (line-beginning-position))
(delete-region point (point)))
(setq haskell-ghc-supported-extensions
(delete-dups (sort (append extentions haskell-ghc-supported-extensions) #'string<)))
(dolist (item haskell-ghc-supported-extensions)
(insert " \"" item "\"\n"))
(re-search-forward "BEGIN haskell-ghc-supported-options")
(forward-line 1)
(let ((point (point)))
(re-search-forward "END haskell-ghc-supported-options")
(goto-char (line-beginning-position))
(delete-region point (point)))
(setq haskell-ghc-supported-options
(delete-dups (sort (append options haskell-ghc-supported-options) #'string<)))
(dolist (item haskell-ghc-supported-options)
(insert " \"" item "\"\n"))))))