emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-mode abce84fef3 6/7: Merge branch 'master' into cu


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-mode abce84fef3 6/7: Merge branch 'master' into cull-markers
Date: Fri, 3 Mar 2023 13:01:20 -0500 (EST)

branch: elpa/haskell-mode
commit abce84fef3282b4232ec46d211dec25d85e84422
Merge: 9cf0ad4ee5 922f730cbd
Author: Steve Purcell <steve@sanityinc.com>
Commit: GitHub <noreply@github.com>

    Merge branch 'master' into cull-markers
---
 .github/workflows/test.yml       |   8 +-
 Makefile                         |   1 +
 ghc-core.el                      |   1 -
 haskell-c2hs.el                  |   2 +-
 haskell-cabal.el                 |  24 +++--
 haskell-collapse.el              |   4 +-
 haskell-commands.el              |  20 +++-
 haskell-compile.el               |  22 +++--
 haskell-completions.el           |  17 ++--
 haskell-customize.el             |  26 ++---
 haskell-debug.el                 |   7 --
 haskell-decl-scan.el             |   3 +-
 haskell-doc.el                   | 204 +++++++++++----------------------------
 haskell-font-lock.el             |  12 +--
 haskell-ghc-support.el           |  74 ++++++++++++++
 haskell-indent.el                |  10 +-
 haskell-indentation.el           |  13 ++-
 haskell-interactive-mode.el      |  16 +--
 haskell-lexeme.el                |  36 +++----
 haskell-load.el                  |  19 ++--
 haskell-mode.el                  |  71 +++++++-------
 haskell-move-nested.el           |   4 +-
 haskell-process.el               |   9 +-
 haskell-utils.el                 |   8 +-
 haskell.el                       |   7 +-
 inf-haskell.el                   |  20 ++--
 tests/haskell-doc-tests.el       |   6 +-
 tests/haskell-font-lock-tests.el |   4 +-
 tests/haskell-mode-tests.el      |   9 ++
 tests/haskell-utils-tests.el     |   2 +-
 w3m-haddock.el                   |   9 +-
 31 files changed, 329 insertions(+), 339 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e68871a5c9..627ba4b419 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -13,19 +13,19 @@ jobs:
       matrix:
         emacs_version:
           - 25.1
-          - 25.2
           - 25.3
           - 26.1
-          - 26.2
           - 26.3
           - 27.1
           - 27.2
+          - 28.1
+          - 28.2
           - snapshot
         include:
-          - emacs_version: 27.2
+          - emacs_version: 28.2
             target: deploy-manual
     steps:
-    - uses: cachix/install-nix-action@v12
+    - uses: cachix/install-nix-action@v20
       with:
         nix_path: nixpkgs=channel:nixos-unstable
     - uses: purcell/setup-emacs@master
diff --git a/Makefile b/Makefile
index 39d6495c89..a6916754db 100644
--- a/Makefile
+++ b/Makefile
@@ -150,6 +150,7 @@ $(AUTOLOADS): $(ELFILES)
        $(BATCH) \
                --eval '(setq make-backup-files nil)' \
                --eval "(setq generated-autoload-file (concat 
command-line-default-directory \"/\" \"$@\"))" \
+               --eval "(require 'autoload)" \
                -f batch-update-autoloads "."
 # check if autoloads will really load
        $(BATCH) -l "$@"
diff --git a/ghc-core.el b/ghc-core.el
index bb6fa6eda2..92951f213b 100644
--- a/ghc-core.el
+++ b/ghc-core.el
@@ -32,7 +32,6 @@
 (require 'haskell-mode)
 (require 'haskell-font-lock)
 
-;;;###autoload
 (defgroup ghc-core nil
   "Major mode for viewing pretty printed GHC Core output."
   :link '(custom-manual "(haskell-mode)")
diff --git a/haskell-c2hs.el b/haskell-c2hs.el
index c4cb41ec37..8eb31ff8f6 100644
--- a/haskell-c2hs.el
+++ b/haskell-c2hs.el
@@ -111,7 +111,7 @@
                        (opt (+ ,ws)
                             (group-n 3
                                      "as")))
-                  ;; TODO: fun hook highlighting is incompelete
+                  ;; TODO: fun hook highlighting is incomplete
                   (seq (group-n 2
                                 (or "call"
                                     "fun")
diff --git a/haskell-cabal.el b/haskell-cabal.el
index a2de2eaa05..99a07e9495 100644
--- a/haskell-cabal.el
+++ b/haskell-cabal.el
@@ -232,8 +232,9 @@ file), then this function returns nil."
 
 ;;;###autoload
 (defun haskell-cabal-get-dir (&optional use-defaults)
-  "Get the Cabal dir for a new project. Various ways of figuring this out,
-   and indeed just prompting the user. Do them all."
+  "Get the Cabal dir for a new project.
+Various ways of figuring this out, and indeed just prompting the user.  Do them
+all."
   (let* ((file (haskell-cabal-find-file))
          (dir (if file (file-name-directory file) default-directory)))
     (if use-defaults
@@ -348,7 +349,6 @@ OTHER-WINDOW use `find-file-other-window'."
     "help"
     "run"))
 
-;;;###autoload
 (defgroup haskell-cabal nil
   "Haskell cabal files"
   :group 'haskell
@@ -361,7 +361,9 @@ OTHER-WINDOW use `find-file-other-window'."
 (defconst haskell-cabal-conditional-regexp "^[ \t]*\\(\\if\\|else\\|}\\)")
 
 (defun haskell-cabal-classify-line ()
-  "Classify the current line into 'section-header 'subsection-header 
'section-data 'comment and 'empty '"
+  "Classify the current line's type.
+Possible results are \\='section-header \\='subsection-header \\='section-data
+\\='comment and \\='empty"
   (save-excursion
     (beginning-of-line)
     (cond
@@ -494,7 +496,8 @@ OTHER-WINDOW use `find-file-other-window'."
           ((equal component-type "benchmark")  "bench"))))
 
 (defun haskell-cabal-enum-targets (&optional process-type)
-  "Enumerate .cabal targets. PROCESS-TYPE determines the format of the 
returned target."
+  "Enumerate .cabal targets.
+PROCESS-TYPE determines the format of the returned target."
   (let ((cabal-file (haskell-cabal-find-file))
         (process-type (if process-type process-type 'ghci)))
     (when (and cabal-file (file-readable-p cabal-file))
@@ -699,7 +702,7 @@ Respect the COMMA-STYLE, see
 `haskell-cabal-strip-list-and-detect-style' for the possible
 styles."
   (cl-case comma-style
-    ('before
+    (before
      (goto-char (point-min))
      (while (haskell-cabal-ignore-line-p) (forward-line))
      (indent-to 2)
@@ -707,14 +710,14 @@ styles."
      (haskell-cabal-each-line
       (unless (haskell-cabal-ignore-line-p)
         (insert ", "))))
-    ('after
+    (after
      (goto-char (point-max))
      (while (equal 0 (forward-line -1))
        (unless (haskell-cabal-ignore-line-p)
          (end-of-line)
          (insert ",")
          (beginning-of-line))))
-    ('single
+    (single
      (goto-char (point-min))
      (while (not (eobp))
        (end-of-line)
@@ -924,9 +927,10 @@ resulting buffer-content.  Unmark line at the end."
                     haskell-cabal-source-bearing-sections))))
 
 (defun haskell-cabal-line-filename ()
-  "Expand filename in current line according to the subsection type
+  "Expand filename in current line according to the subsection type.
 
-Module names in exposed-modules and other-modules are expanded by replacing 
each dot (.) in the module name with a forward slash (/) and appending \".hs\"
+Module names in exposed-modules and other-modules are expanded by replacing 
each
+dot (.) in the module name with a forward slash (/) and appending \".hs\"
 
 Example: Foo.Bar.Quux ==> Foo/Bar/Quux.hs
 
diff --git a/haskell-collapse.el b/haskell-collapse.el
index 8a73fa3887..8c4d7906f5 100644
--- a/haskell-collapse.el
+++ b/haskell-collapse.el
@@ -43,7 +43,7 @@
   "Returns `t' if line is empty or composed only of whitespace."
   (save-excursion
     (beginning-of-line)
-    (= (point-at-eol)
+    (= (line-end-position)
        (progn (skip-chars-forward "[:blank:]") (point)))))
 
 (defun haskell-indented-block ()
@@ -92,7 +92,7 @@ indentation if dir=-1"
   (save-excursion
     (goto-char (point-max))
     (while (zerop (forward-line -1))
-      (goto-char (point-at-bol))
+      (goto-char (line-beginning-position))
       (when (= (current-indentation) 0) (haskell-hide-toggle)))))
 
 (defvar haskell-collapse-mode-map
diff --git a/haskell-commands.el b/haskell-commands.el
index fba236d47e..f9ed3da4cf 100644
--- a/haskell-commands.el
+++ b/haskell-commands.el
@@ -36,6 +36,7 @@
 (require 'haskell-utils)
 (require 'highlight-uses-mode)
 (require 'haskell-cabal)
+(require 'haskell-ghc-support)
 
 (defcustom haskell-mode-stylish-haskell-path "stylish-haskell"
   "Path to `stylish-haskell' executable."
@@ -652,11 +653,11 @@ happened since function invocation)."
           (cl-case res-type
             ;; neither popup presentation buffer
             ;; nor insert response in error case
-            ('unknown-command
+            (unknown-command
              (message "This command requires GHCi 8+ or GHCi-ng. Please read 
command description for details."))
-            ('option-missing
+            (option-missing
              (message "Could not infer type signature. You need to load file 
first. Also :set +c is required, see customization 
`haskell-interactive-set-+c'. Please read command description for details."))
-            ('interactive-error (message "Wrong REPL response: %s" sig))
+            (interactive-error (message "Wrong REPL response: %s" sig))
             (otherwise
              (if insert-value
                  ;; Only insert type signature and do not present it
@@ -676,9 +677,9 @@ happened since function invocation)."
                             (cdr (reverse 
haskell-utils-async-post-command-flag))))
                ;; Present the result only when response is valid and not asked
                ;; to insert result
-               (haskell-command-echo-or-present response)))
+               (haskell-command-echo-or-present response))))
 
-            (haskell-utils-async-stop-watching-changes init-buffer))))))))
+          (haskell-utils-async-stop-watching-changes init-buffer)))))))
 
 (make-obsolete 'haskell-process-generate-tags
                'haskell-mode-generate-tags
@@ -935,5 +936,14 @@ newlines and extra whitespace in signature before 
insertion."
         (insert sig "\n")
         (indent-to col)))))
 
+(defun haskell-command-insert-language-pragma (extension)
+  "Insert a {-# LANGUAGE _ #-} pragma at the top of the current
+buffer for the given extension."
+  (interactive
+   (list (completing-read "Extension: " haskell-ghc-supported-extensions)))
+  (save-excursion
+    (goto-char (point-min))
+    (insert (format "{-# LANGUAGE %s #-}\n" extension))))
+
 (provide 'haskell-commands)
 ;;; haskell-commands.el ends here
diff --git a/haskell-compile.el b/haskell-compile.el
index 4ef85f1e74..a9779ddbe0 100644
--- a/haskell-compile.el
+++ b/haskell-compile.el
@@ -34,7 +34,6 @@
 (require 'ansi-color)
 (eval-when-compile (require 'subr-x))
 
-;;;###autoload
 (defgroup haskell-compile nil
   "Settings for Haskell compilation mode"
   :link '(custom-manual "(haskell-mode)compilation")
@@ -42,35 +41,40 @@
 
 (defcustom haskell-compile-cabal-build-command
   "cabal build --ghc-option=-ferror-spans"
-  "Default build command to use for `haskell-cabal-build' when a cabal file is 
detected.
+  "Default build command to use for `haskell-cabal-build'.
+It is used when a cabal file is detected.
 For legacy compat, `%s' is replaced by the cabal package top folder."
   :group 'haskell-compile
   :type 'string)
 
 (defcustom haskell-compile-cabal-build-alt-command
   "cabal clean -s && cabal build --ghc-option=-ferror-spans"
-  "Alternative build command to use when `haskell-cabal-build' is called with 
a negative prefix argument.
+  "Alternative build command to use when `haskell-cabal-build'.
+It is used when `haskell-cabal-build' is called with a negative prefix 
argument.
 For legacy compat, `%s' is replaced by the cabal package top folder."
   :group 'haskell-compile
   :type 'string)
 
 (defcustom haskell-compile-stack-build-command
   "stack build --fast"
-  "Default build command to use for `haskell-stack-build' when a stack file is 
detected.
+  "Default build command to use for `haskell-stack-build'.
+It is used when a stack file is detected.
 For legacy compat, `%s' is replaced by the stack package top folder."
   :group 'haskell-compile
   :type 'string)
 
 (defcustom haskell-compile-stack-build-alt-command
   "stack clean && stack build --fast"
-  "Alternative build command to use when `haskell-stack-build' is called with 
a negative prefix argument.
+  "Alternative build command to use when `haskell-stack-build'.
+It is used when `haskell-stack-build' is called with a negative prefix 
argument.
 For legacy compat, `%s' is replaced by the stack package top folder."
   :group 'haskell-compile
   :type 'string)
 
 (defcustom haskell-compile-command
   "ghc -Wall -ferror-spans -fforce-recomp -c %s"
-  "Default build command to use for `haskell-cabal-build' when no cabal or 
stack file is detected.
+  "Default build command to use for `haskell-cabal-build'.
+It is used when no cabal or stack file is detected.
 The `%s' placeholder is replaced by the current buffer's filename."
   :group 'haskell-compile
   :type 'string)
@@ -84,8 +88,8 @@ The `%s' placeholder is replaced by the current buffer's 
filename."
 (defcustom haskell-compiler-type
   'auto
   "Controls whether to use cabal, stack, or ghc to compile.
-   Auto (the default) means infer from the presence of a cabal or stack spec 
file,
-   following same rules as haskell-process-type."
+Auto (the default) means infer from the presence of a cabal or stack spec file,
+following same rules as haskell-process-type."
     :type '(choice (const auto) (const ghc) (const stack) (const cabal))
     :group 'haskell-compile)
 (make-variable-buffer-local 'haskell-compiler-type)
@@ -229,7 +233,7 @@ base directory for build tools, or the current buffer for
                     ((null edit) default)
                     ((eq edit '-) alt)
                     (t (compilation-read-command default))))
-         (command (format template local-dir-or-file))
+         (command (format template (shell-quote-argument local-dir-or-file)))
          (dir (if (directory-name-p local-dir-or-file)
                   local-dir-or-file
                 default-directory))
diff --git a/haskell-completions.el b/haskell-completions.el
index 2512188694..f4ea94d186 100644
--- a/haskell-completions.el
+++ b/haskell-completions.el
@@ -31,7 +31,7 @@
 ;;
 ;; For major use function `haskell-completions-grab-prefix' is supposed, and
 ;; other prefix grabbing functions are used internally by it.  So, only this
-;; funciton have prefix minimal length functionality and invokes predicate
+;; function have prefix minimal length functionality and invokes predicate
 ;; function `haskell-completions-can-grab-prefix'.
 
 ;;; Code:
@@ -40,7 +40,6 @@
 (require 'haskell-process)
 (require 'haskell-interactive-mode)
 
-;;;###autoload
 (defgroup haskell-completions nil
   "Settings for completions provided by `haskell-mode'"
   :link '(custom-manual "(haskell-mode)Completion support")
@@ -145,7 +144,7 @@ whitespace or new line, otherwise returns nil.
 
 (defun haskell-completions-grab-pragma-prefix ()
   "Grab completion prefix for pragma completions.
-Returns a list of form '(prefix-start-position
+Returns a list of form \\='(prefix-start-position
 prefix-end-position prefix-value prefix-type) for pramga names
 such as WARNING, DEPRECATED, LANGUAGE etc.  Also returns
 completion prefixes for options in case OPTIONS_GHC pragma, or
@@ -215,7 +214,7 @@ pragma is supported also."
 
 (defun haskell-completions-grab-identifier-prefix ()
   "Grab completion prefix for identifier at point.
-Returns a list of form '(prefix-start-position
+Returns a list of form \\='(prefix-start-position
 prefix-end-position prefix-value prefix-type) for haskell
 identifier at point depending on result of function
 `haskell-ident-pos-at-point'."
@@ -227,7 +226,7 @@ identifier at point depending on result of function
              (type 'haskell-completions-identifier-prefix)
              (case-fold-search nil)
              value)
-        ;; we need end position of result, becase of
+        ;; we need end position of result, because of
         ;; `haskell-ident-pos-at-point' ignores trailing whitespace, e.g. the
         ;; result will be same for `map|` and `map  |` invocations.
         (when (<= p end)
@@ -266,7 +265,7 @@ identifier at point depending on result of function
 
 (defun haskell-completions-grab-prefix (&optional minlen)
    "Grab prefix at point for possible completion.
-Returns a list of form '(prefix-start-position
+Returns a list of form \\='(prefix-start-position
 prefix-end-position prefix-value prefix-type) depending on
 situation, e.g. is it needed to complete pragma, module name,
 arbitrary identifier, etc.  Returns nil in case it is
@@ -309,11 +308,11 @@ PREFIX should be a list such one returned by
     (when (not (eql typ 'haskell-completions-general-prefix))
       (let ((candidates
              (cl-case typ
-               ('haskell-completions-pragma-name-prefix
+               (haskell-completions-pragma-name-prefix
                 haskell-completions--pragma-names)
-               ('haskell-completions-ghc-option-prefix
+               (haskell-completions-ghc-option-prefix
                 haskell-ghc-supported-options)
-               ('haskell-completions-language-extension-prefix
+               (haskell-completions-language-extension-prefix
                 haskell-ghc-supported-extensions)
                (otherwise
                 (append (when (bound-and-true-p haskell-tags-on-save)
diff --git a/haskell-customize.el b/haskell-customize.el
index f2c12cd7c3..dccddc7a6e 100644
--- a/haskell-customize.el
+++ b/haskell-customize.el
@@ -28,7 +28,6 @@
   :type 'boolean
   :group 'haskell-interactive)
 
-;;;###autoload
 (defgroup haskell nil
   "Major mode for editing Haskell programs."
   :link '(custom-manual "(haskell-mode)")
@@ -50,9 +49,11 @@ Used for locating additional package data files.")
 
 (defcustom haskell-process-type
   'auto
-  "The inferior Haskell process type to use: ghci, stack, cabal, or auto.
+  "The inferior Haskell process type to use.
 
-When set to 'auto (the default), the directory contents and
+Customize this variable to see the supported symbol values.
+
+When set to \\='auto (the default), the directory contents and
 available programs will be used to make a best guess at the
 process type and the project directory.
 
@@ -85,7 +86,7 @@ The following example function arranges for all haskell 
process
 commands to be started in the current nix-shell environment:
 
   (lambda (argv) (append (list \"nix-shell\" \"-I\" \".\" \"--command\" )
-                    (list (mapconcat 'identity argv \" \"))))
+                    (list (mapconcat \\='identity argv \" \"))))
 
 See Info Node `(emacs)Directory Variables' for a way to set this option on
 a per-project basis."
@@ -113,7 +114,6 @@ when showing type information about symbols."
 (defvar haskell-process-ended-functions (list 'haskell-process-prompt-restart)
   "Hook for when the haskell process ends.")
 
-;;;###autoload
 (defgroup haskell-interactive nil
   "Settings for REPL interaction via `haskell-interactive-mode'"
   :link '(custom-manual "(haskell-mode)haskell-interactive-mode")
@@ -172,7 +172,8 @@ pass additional flags to `ghc'."
 
 (defcustom haskell-process-do-cabal-format-string
   ":!cd %s && %s"
-  "The way to run cabal commands. It takes two arguments -- the directory and 
the command.
+  "The way to run cabal commands.
+It takes two arguments -- the directory and the command.
 See `haskell-process-do-cabal' for more details."
   :group 'haskell-interactive
   :type 'string)
@@ -241,7 +242,8 @@ is a member of the hidden package, blah blah."
 
 (defcustom haskell-process-suggest-overloaded-strings
   t
-  "Suggest adding OverloadedStrings pragma to file when getting type 
mismatches with [Char]."
+  "Suggest adding OverloadedStrings pragma to file.
+It is used when getting type mismatches with [Char]."
   :type 'boolean
   :group 'haskell-interactive)
 
@@ -365,7 +367,7 @@ read-only property."
   '()
   "Support a mapping from module to import lines.
 
-E.g. '((\"Data.Map\" . \"import qualified Data.Map as M
+E.g. \\='((\"Data.Map\" . \"import qualified Data.Map as M
 import Data.Map (Map)
 \"))
 
@@ -411,9 +413,9 @@ presence of a *.cabal file or stack.yaml file or something 
similar.")
 (defun haskell-build-type ()
   "Looks for cabal and stack spec files.
    When found, returns a pair (TAG . DIR)
-   where TAG is 'cabal-project, 'cabal-sandbox. 'cabal, or 'stack;
+   where TAG is \\='cabal-project, \\='cabal-sandbox. \\='cabal, or \\='stack;
    and DIR is the directory containing cabal or stack file.
-   When none found, DIR is nil, and TAG is 'ghc"
+   When none found, DIR is nil, and TAG is \\='ghc"
   ;; REVIEW maybe just 'cabal is enough.
   (let ((cabal-project (locate-dominating-file default-directory 
"cabal.project"))
         (cabal-sandbox (locate-dominating-file default-directory 
"cabal.sandbox.config"))
@@ -437,8 +439,8 @@ presence of a *.cabal file or stack.yaml file or something 
similar.")
      (t (error "Could not find any installation of GHC.")))))
 
 (defun haskell-process-type ()
-  "Return `haskell-process-type', or a guess if that variable is 'auto.
-   Converts the obsolete 'cabal-new-repl to its equivalent 'cabal-repl.
+  "Return `haskell-process-type', or a guess if that variable is \\='auto.
+   Converts the obsolete \\='cabal-new-repl to its equivalent \\='cabal-repl.
    May also set `inferior-haskell-root-dir'"
   (cond
    ((eq 'cabal-new-repl haskell-process-type)
diff --git a/haskell-debug.el b/haskell-debug.el
index 38a6859bbd..3e73c06379 100644
--- a/haskell-debug.el
+++ b/haskell-debug.el
@@ -28,43 +28,36 @@
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Configuration
 
-;;;###autoload
 (defgroup haskell-debug nil
   "Settings for debugging support."
   :link '(custom-manual "(haskell-mode)haskell-debug")
   :group 'haskell)
 
-;;;###autoload
 (defface haskell-debug-warning-face
   '((t :inherit 'compilation-warning))
   "Face for warnings."
   :group 'haskell-debug)
 
-;;;###autoload
 (defface haskell-debug-trace-number-face
   '((t :weight bold :background "#f5f5f5"))
   "Face for numbers in backtrace."
   :group 'haskell-debug)
 
-;;;###autoload
 (defface haskell-debug-newline-face
   '((t :weight bold :background "#f0f0f0"))
   "Face for newlines in trace steps."
   :group 'haskell-debug)
 
-;;;###autoload
 (defface haskell-debug-keybinding-face
   '((t :inherit 'font-lock-type-face :weight bold))
   "Face for keybindings."
   :group 'haskell-debug)
 
-;;;###autoload
 (defface haskell-debug-heading-face
   '((t :inherit 'font-lock-keyword-face))
   "Face for headings."
   :group 'haskell-debug)
 
-;;;###autoload
 (defface haskell-debug-muted-face
   '((t :foreground "#999"))
   "Face for muteds."
diff --git a/haskell-decl-scan.el b/haskell-decl-scan.el
index e1f6977326..2f4ddff2a1 100644
--- a/haskell-decl-scan.el
+++ b/haskell-decl-scan.el
@@ -107,7 +107,6 @@
 (require 'syntax)
 (require 'imenu)
 
-;;;###autoload
 (defgroup haskell-decl-scan nil
   "Haskell declaration scanning (`imenu' support)."
   :link '(custom-manual "(haskell-mode)haskell-decl-scan-mode")
@@ -514,7 +513,7 @@ positions and the type is one of the symbols \"variable\", 
\"datatype\",
                             (skip-chars-backward " \t")
                             (point))))))
           ;; If we did not manage to extract a name, cancel this
-          ;; declaration (eg. when line ends in "=> ").
+          ;; declaration (e.g. when line ends in "=> ").
           (if (string-match "^[ \t]*$" name) (setq name nil))
           (setq type 'instance)))
         ;; Move past start of current declaration.
diff --git a/haskell-doc.el b/haskell-doc.el
index 5ac49b8f87..b132ddddf7 100644
--- a/haskell-doc.el
+++ b/haskell-doc.el
@@ -308,45 +308,12 @@
 (require 'imenu)
 (require 'eldoc)
 
-;;;###autoload
 (defgroup haskell-doc nil
   "Show Haskell function types in echo area."
   :group 'haskell
   :prefix "haskell-doc-")
 
 
-(defvar-local haskell-doc-mode nil
-  "*If non-nil, show the type of the function near point or a related comment.
-
-If the identifier near point is a Haskell keyword and the variable
-`haskell-doc-show-reserved' is non-nil show a one line summary
-of the syntax.
-
-If the identifier near point is a Prelude or one of the standard library
-functions and `haskell-doc-show-prelude' is non-nil show its type.
-
-If the identifier near point is local \(i.e. defined in this module\) check
-the `imenu' list of functions for the type.  This obviously requires that
-your language mode uses `imenu'.
-
-If the identifier near point is global \(i.e. defined in an imported module\)
-and the variable `haskell-doc-show-global-types' is non-nil show the type of 
its
-function.
-
-If the identifier near point is a standard strategy or a function, type related
-related to strategies and `haskell-doc-show-strategy' is non-nil show the type
-of the function.  Strategies are special to the parallel execution of Haskell.
-If you're not interested in that just turn it off.
-
-If the identifier near point is a user defined function that occurs as key
-in the alist `haskell-doc-user-defined-ids' and the variable
-`haskell-doc-show-user-defined' is non-nil show the type of the function.
-
-This variable is buffer-local.")
-
-(defvar haskell-doc-mode-hook nil
-  "Hook invoked when entering `haskell-doc-mode'.")
-
 (defvar-local haskell-doc-index nil
   "Variable holding an alist matching file names to fct-type alists.
 The function `haskell-doc-make-global-fct-index' rebuilds this variables
@@ -406,14 +373,6 @@ This variable is buffer-local."
 (defvar haskell-doc-search-distance 40  ; distance in characters
   "*How far to search when looking for the type declaration of fct under 
cursor.")
 
-
-(defvar haskell-doc-idle-delay 0.50
-  "*Number of seconds of idle time to wait before printing.
-If user input arrives before this interval of time has elapsed after the
-last input, no documentation will be printed.
-
-If this variable is set to 0, no idle time is required.")
-
 (defvar haskell-doc-argument-case 'identity ; 'upcase
   "Case in which to display argument names of functions, as a symbol.
 This has two preferred values: `upcase' or `downcase'.
@@ -1239,81 +1198,56 @@ URL is the URL of the online doc."
       '("Toggle display of reserved ids" . haskell-doc-show-reserved))
     (define-key map [haskell-doc-on]
       '("Toggle haskell-doc mode" . haskell-doc-mode))
+    (define-key map  [(control shift meta mouse-3)]
+      'haskell-doc-ask-mouse-for-type)
     map))
 
-(defun haskell-doc-install-keymap ()
-  "Install a menu for `haskell-doc-mode' as a submenu of \"Hugs\"."
-  (interactive)
-  ;; Add the menu to the hugs menu as last entry.
-  (let ((hugsmap (lookup-key (current-local-map) [menu-bar Hugs])))
-    (if (not (or (featurep 'xemacs) ; XEmacs has problems here
-                 (not (keymapp hugsmap))
-                 (lookup-key hugsmap [haskell-doc])))
-        (if (functionp 'define-key-after)
-            (define-key-after hugsmap [haskell-doc]
-              (cons "Haskell-doc" haskell-doc-keymap)
-              [Haskell-doc mode]))))
-  ;; Add shortcuts for these commands.
-  (local-set-key "\C-c\e/" 'haskell-doc-check-active)
-  ;; Conflicts with the binding of haskell-insert-otherwise.
-  ;; (local-set-key "\C-c\C-o" 'haskell-doc-mode)
-  (local-set-key [(control shift meta mouse-3)]
-                 'haskell-doc-ask-mouse-for-type))
-
-
-(defvar haskell-doc-timer nil)
-(defvar haskell-doc-buffers nil)
 
 ;;;###autoload
-(defun haskell-doc-mode (&optional arg)
+(define-minor-mode haskell-doc-mode
   "Enter `haskell-doc-mode' for showing fct types in the echo area.
-See variable docstring."
-  (interactive (list (or current-prefix-arg 'toggle)))
-
-  (setq haskell-doc-mode
-        (cond
-         ((eq arg 'toggle) (not haskell-doc-mode))
-         (arg (> (prefix-numeric-value arg) 0))
-         (t)))
-
-  ;; First, unconditionally turn the mode OFF.
-
-  (setq haskell-doc-buffers (delq (current-buffer) haskell-doc-buffers))
-  ;; Refresh the buffers list.
-  (dolist (buf haskell-doc-buffers)
-    (unless (and (buffer-live-p buf)
-                 (with-current-buffer buf haskell-doc-mode))
-      (setq haskell-doc-buffers (delq buf haskell-doc-buffers))))
-  ;; Turn off the idle timer (or idle post-command-hook).
-  (when (and haskell-doc-timer (null haskell-doc-buffers))
-    (cancel-timer haskell-doc-timer)
-    (setq haskell-doc-timer nil))
-  (remove-hook 'post-command-hook
-               'haskell-doc-mode-print-current-symbol-info 'local)
 
-  (when haskell-doc-mode
-    ;; Turning the mode ON.
-    (push (current-buffer) haskell-doc-buffers)
+When enabled, shows the type of the function near point or a related comment.
 
-    (if (fboundp 'run-with-idle-timer)
-        (unless haskell-doc-timer
-          (setq haskell-doc-timer
-                (run-with-idle-timer
-                 haskell-doc-idle-delay t
-                 'haskell-doc-mode-print-current-symbol-info)))
-      (add-hook 'post-command-hook
-                'haskell-doc-mode-print-current-symbol-info nil 'local))
-    (and haskell-doc-show-global-types
-         (haskell-doc-make-global-fct-index)) ; build type index for global 
fcts
+If the identifier near point is a Haskell keyword and the variable
+`haskell-doc-show-reserved' is non-nil show a one line summary
+of the syntax.
 
-    (haskell-doc-install-keymap)
+If the identifier near point is a Prelude or one of the standard library
+functions and `haskell-doc-show-prelude' is non-nil show its type.
 
-    (run-hooks 'haskell-doc-mode-hook))
+If the identifier near point is local \(i.e. defined in this module\) check
+the `imenu' list of functions for the type.  This obviously requires that
+your language mode uses `imenu'.
 
-  (and (called-interactively-p 'any)
-       (message "haskell-doc-mode is %s"
-                (if haskell-doc-mode "enabled" "disabled")))
-  haskell-doc-mode)
+If the identifier near point is global \(i.e. defined in an imported module\)
+and the variable `haskell-doc-show-global-types' is non-nil show the type of 
its
+function.
+
+If the identifier near point is a standard strategy or a function, type related
+related to strategies and `haskell-doc-show-strategy' is non-nil show the type
+of the function.  Strategies are special to the parallel execution of Haskell.
+If you're not interested in that just turn it off.
+
+If the identifier near point is a user defined function that occurs as key
+in the alist `haskell-doc-user-defined-ids' and the variable
+`haskell-doc-show-user-defined' is non-nil show the type of the function.
+
+This variable is buffer-local."
+  :global nil
+  :keymap haskell-doc-keymap
+
+  (and haskell-doc-show-global-types
+       (haskell-doc-make-global-fct-index)) ; build type index for global fcts
+  (if (boundp 'eldoc-documentation-functions)
+      (if haskell-doc-mode
+          (add-hook 'eldoc-documentation-functions 'haskell-doc-eldoc-function 
nil t)
+        (remove-hook 'eldoc-documentation-functions 
'haskell-doc-eldoc-function t))
+    (if haskell-doc-mode
+        (setq-local eldoc-documentation-function 'haskell-doc-eldoc-function)
+      (kill-local-variable eldoc-documentation-function)))
+  (when haskell-doc-mode
+    (eldoc-mode)))
 
 (defmacro haskell-doc-toggle-var (id prefix)
   ;; toggle variable or set it based on prefix value
@@ -1368,46 +1302,22 @@ See variable docstring."
   "Unequivocally turn off `haskell-doc-mode' (which see)."
   (haskell-doc-mode 0))
 
-(defun haskell-doc-check-active ()
-  "Check whether the print function is hooked in.
-Should be the same as the value of `haskell-doc-mode' but alas currently it
-is not."
-  (interactive)
-  (message "%s"
-           (if (or (and haskell-doc-mode haskell-doc-timer)
-                   (memq 'haskell-doc-mode-print-current-symbol-info
-                         post-command-hook))
-               "haskell-doc is ACTIVE"
-             (substitute-command-keys
-              "haskell-doc is not ACTIVE \(Use \\[haskell-doc-mode] to turn it 
on\)"))))
-
-
-;; This is the function hooked into the elisp command engine
-(defun haskell-doc-mode-print-current-symbol-info ()
-  "Print the type of the symbol under the cursor.
-
-This function is run by an idle timer to print the type
- automatically if `haskell-doc-mode' is turned on."
-  (and haskell-doc-mode
-       (haskell-doc-in-code-p)
-       (not haskell-mode-interactive-prompt-state)
-       (not (eobp))
-       (not executing-kbd-macro)
-       ;; Having this mode operate in the minibuffer makes it impossible to
-       ;; see what you're doing.
-       (not (eq (selected-window) (minibuffer-window)))
-       ;; not in string or comment
-       ;; take a nap, if run straight from post-command-hook.
-       (if (fboundp 'run-with-idle-timer) t
-         (sit-for haskell-doc-idle-delay))
-       ;; good morning! read the word under the cursor for breakfast
-       (haskell-doc-show-type)))
-;; ;; ToDo: find surrounding fct
-;; (cond ((eq current-symbol current-fnsym)
-;;        (haskell-doc-show-type current-fnsym))
-;;       (t
-;;        (or nil ; (haskell-doc-print-var-docstring current-symbol)
-;;            (haskell-doc-show-type current-fnsym)))))))
+;;;###autoload
+(defun haskell-doc-eldoc-function (&optional callback)
+  "Function for use by eldoc.
+
+By accepting CALLBACK, it is designed to be used in
+`eldoc-documentation-functions' in Emacs >= 28.1, but by making
+that argument optional it can also be set directly as
+`eldoc-documentation-function' in older Emacsen."
+  (when (and haskell-doc-mode
+             (haskell-doc-in-code-p)
+             (not haskell-mode-interactive-prompt-state)
+             (not (eobp))
+             (not executing-kbd-macro))
+    (if callback
+        (funcall callback (haskell-doc-current-info))
+      (haskell-doc-current-info))))
 
 ;;;###autoload
 (defun haskell-doc-current-info ()
@@ -1451,7 +1361,7 @@ current buffer."
   ;; if printed before do not print it again
   (unless (string= sym (car haskell-doc-last-data))
     (let ((doc (or (haskell-doc-current-info--interaction t)
-                  (haskell-doc-sym-doc sym))))
+                   (haskell-doc-sym-doc sym))))
       (when (and doc (haskell-doc-in-code-p))
         ;; In Emacs 19.29 and later, and XEmacs 19.13 and later, all
         ;; messages are recorded in a log.  Do not put haskell-doc messages
diff --git a/haskell-font-lock.el b/haskell-font-lock.el
index 29f888da5a..52ef62533e 100644
--- a/haskell-font-lock.el
+++ b/haskell-font-lock.el
@@ -31,7 +31,6 @@
 (require 'haskell-string)
 (require 'font-lock)
 
-;;;###autoload
 (defgroup haskell-appearance nil
   "Haskell Appearance."
   :group 'haskell)
@@ -145,19 +144,16 @@ font faces assigned as if respective mode was enabled."
   :group 'haskell-appearance
   :type '(repeat (cons string symbol)))
 
-;;;###autoload
 (defface haskell-keyword-face
   '((t :inherit font-lock-keyword-face))
   "Face used to highlight Haskell keywords."
   :group 'haskell-appearance)
 
-;;;###autoload
 (defface haskell-type-face
   '((t :inherit font-lock-type-face))
   "Face used to highlight Haskell types"
   :group 'haskell-appearance)
 
-;;;###autoload
 (defface haskell-constructor-face
   '((t :inherit font-lock-type-face))
   "Face used to highlight Haskell constructors."
@@ -165,7 +161,7 @@ font faces assigned as if respective mode was enabled."
 
 ;; This used to be `font-lock-variable-name-face' but it doesn't result in
 ;; a highlighting that's consistent with other modes (it's mostly used
-;; for function defintions).
+;; for function definitions).
 (defface haskell-definition-face
   '((t :inherit font-lock-function-name-face))
   "Face used to highlight Haskell definitions."
@@ -174,25 +170,21 @@ font faces assigned as if respective mode was enabled."
 ;; This is probably just wrong, but it used to use
 ;; `font-lock-function-name-face' with a result that was not consistent with
 ;; other major modes, so I just exchanged with `haskell-definition-face'.
-;;;###autoload
 (defface haskell-operator-face
   '((t :inherit font-lock-variable-name-face))
   "Face used to highlight Haskell operators."
   :group 'haskell-appearance)
 
-;;;###autoload
 (defface haskell-pragma-face
   '((t :inherit font-lock-preprocessor-face))
   "Face used to highlight Haskell pragmas ({-# ... #-})."
   :group 'haskell-appearance)
 
-;;;###autoload
 (defface haskell-liquid-haskell-annotation-face
   '((t :inherit haskell-pragma-face))
   "Face used to highlight LiquidHaskell annotations ({-@ ... @-})."
   :group 'haskell-appearance)
 
-;;;###autoload
 (defface haskell-literate-comment-face
   '((t :inherit font-lock-doc-face))
   "Face with which to fontify literate comments.
@@ -426,7 +418,7 @@ on an uppercase identifier."
 
             ;; Special case for `foreign import'
             ;; keywords in foreign import statements but are not otherwise 
reserved.
-            ("\\<\\(foreign\\)[ \t]+\\(import\\)[ 
\t]+\\(?:\\(ccall\\|stdcall\\|cplusplus\\|jvm\\|dotnet\\)[ 
\t]+\\)?\\(?:\\(safe\\|unsafe\\|interruptible\\)[ \t]+\\)?"
+            ("\\<\\(foreign\\)[ \t]+\\(import\\)[ 
\t]+\\(?:\\(ccall\\|capi\\|stdcall\\|cplusplus\\|jvm\\|dotnet\\)[ 
\t]+\\)?\\(?:\\(safe\\|unsafe\\|interruptible\\)[ \t]+\\)?"
              (1 'haskell-keyword-face nil lax)
              (2 'haskell-keyword-face nil lax)
              (3 'haskell-keyword-face nil lax)
diff --git a/haskell-ghc-support.el b/haskell-ghc-support.el
index 3eb84ce17b..010a788ef1 100644
--- a/haskell-ghc-support.el
+++ b/haskell-ghc-support.el
@@ -64,12 +64,14 @@
     "ExplicitForAll"
     "ExplicitNamespaces"
     "ExtendedDefaultRules"
+    "FieldSelectors"
     "FlexibleContexts"
     "FlexibleInstances"
     "ForeignFunctionInterface"
     "FunctionalDependencies"
     "GADTSyntax"
     "GADTs"
+    "GHC2021"
     "GHCForeignImportPrim"
     "GeneralisedNewtypeDeriving"
     "GeneralizedNewtypeDeriving"
@@ -138,6 +140,7 @@
     "NoExplicitForAll"
     "NoExplicitNamespaces"
     "NoExtendedDefaultRules"
+    "NoFieldSelectors"
     "NoFlexibleContexts"
     "NoFlexibleInstances"
     "NoForeignFunctionInterface"
@@ -180,6 +183,8 @@
     "NoOverlappingInstances"
     "NoOverloadedLabels"
     "NoOverloadedLists"
+    "NoOverloadedRecordDot"
+    "NoOverloadedRecordUpdate"
     "NoOverloadedStrings"
     "NoPackageImports"
     "NoParallelArrays"
@@ -226,6 +231,7 @@
     "NoUndecidableInstances"
     "NoUndecidableSuperClasses"
     "NoUnicodeSyntax"
+    "NoUnliftedDatatypes"
     "NoUnliftedFFITypes"
     "NoUnliftedNewtypes"
     "NoViewPatterns"
@@ -236,6 +242,8 @@
     "OverlappingInstances"
     "OverloadedLabels"
     "OverloadedLists"
+    "OverloadedRecordDot"
+    "OverloadedRecordUpdate"
     "OverloadedStrings"
     "PackageImports"
     "ParallelArrays"
@@ -284,6 +292,7 @@
     "UndecidableInstances"
     "UndecidableSuperClasses"
     "UnicodeSyntax"
+    "UnliftedDatatypes"
     "UnliftedFFITypes"
     "UnliftedNewtypes"
     "Unsafe"
@@ -329,6 +338,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "--print-tables-next-to-code"
     "--print-target-platform"
     "--print-unregisterised"
+    "--run"
     "--show-iface"
     "--show-options"
     "--show-packages"
@@ -356,6 +366,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wall-missed-specialisations"
     "-Wall-missed-specializations"
     "-Walternative-layout-rule-transitional"
+    "-Wambiguous-fields"
     "-Wamp"
     "-Wauto-orphans"
     "-Wcompat"
@@ -379,6 +390,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Werror=all-missed-specialisations"
     "-Werror=all-missed-specializations"
     "-Werror=alternative-layout-rule-transitional"
+    "-Werror=ambiguous-fields"
     "-Werror=auto-orphans"
     "-Werror=compat"
     "-Werror=compat-unqualified-imports"
@@ -398,6 +410,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Werror=hi-shadowing"
     "-Werror=identities"
     "-Werror=implicit-kind-vars"
+    "-Werror=implicit-lift"
     "-Werror=implicit-prelude"
     "-Werror=inaccessible-code"
     "-Werror=incomplete-patterns"
@@ -416,6 +429,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Werror=missing-fields"
     "-Werror=missing-home-modules"
     "-Werror=missing-import-lists"
+    "-Werror=missing-kind-signatures"
     "-Werror=missing-local-signatures"
     "-Werror=missing-local-sigs"
     "-Werror=missing-methods"
@@ -429,12 +443,15 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Werror=noncanonical-monad-instances"
     "-Werror=noncanonical-monadfail-instances"
     "-Werror=noncanonical-monoid-instances"
+    "-Werror=operator-whitespace"
+    "-Werror=operator-whitespace-ext-conflict"
     "-Werror=orphans"
     "-Werror=overflowed-literals"
     "-Werror=overlapping-patterns"
     "-Werror=partial-fields"
     "-Werror=partial-type-signatures"
     "-Werror=prepositive-qualified-module"
+    "-Werror=redundant-bang-patterns"
     "-Werror=redundant-constraints"
     "-Werror=redundant-record-wildcards"
     "-Werror=safe"
@@ -447,6 +464,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Werror=type-defaults"
     "-Werror=typed-holes"
     "-Werror=unbanged-strict-patterns"
+    "-Werror=unicode-bidirectional-format-characters"
     "-Werror=unrecognised-pragmas"
     "-Werror=unrecognised-warning-flags"
     "-Werror=unsafe"
@@ -470,6 +488,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Whi-shadowing"
     "-Widentities"
     "-Wimplicit-kind-vars"
+    "-Wimplicit-lift"
     "-Wimplicit-prelude"
     "-Winaccessible-code"
     "-Wincomplete-patterns"
@@ -488,6 +507,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wmissing-fields"
     "-Wmissing-home-modules"
     "-Wmissing-import-lists"
+    "-Wmissing-kind-signatures"
     "-Wmissing-local-signatures"
     "-Wmissing-local-sigs"
     "-Wmissing-methods"
@@ -502,6 +522,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-all-missed-specialisations"
     "-Wno-all-missed-specializations"
     "-Wno-alternative-layout-rule-transitional"
+    "-Wno-ambiguous-fields"
     "-Wno-amp"
     "-Wno-auto-orphans"
     "-Wno-compat"
@@ -524,6 +545,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-error=all-missed-specialisations"
     "-Wno-error=all-missed-specializations"
     "-Wno-error=alternative-layout-rule-transitional"
+    "-Wno-error=ambiguous-fields"
     "-Wno-error=auto-orphans"
     "-Wno-error=compat"
     "-Wno-error=compat-unqualified-imports"
@@ -543,6 +565,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-error=hi-shadowing"
     "-Wno-error=identities"
     "-Wno-error=implicit-kind-vars"
+    "-Wno-error=implicit-lift"
     "-Wno-error=implicit-prelude"
     "-Wno-error=inaccessible-code"
     "-Wno-error=incomplete-patterns"
@@ -561,6 +584,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-error=missing-fields"
     "-Wno-error=missing-home-modules"
     "-Wno-error=missing-import-lists"
+    "-Wno-error=missing-kind-signatures"
     "-Wno-error=missing-local-signatures"
     "-Wno-error=missing-local-sigs"
     "-Wno-error=missing-methods"
@@ -574,12 +598,15 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-error=noncanonical-monad-instances"
     "-Wno-error=noncanonical-monadfail-instances"
     "-Wno-error=noncanonical-monoid-instances"
+    "-Wno-error=operator-whitespace"
+    "-Wno-error=operator-whitespace-ext-conflict"
     "-Wno-error=orphans"
     "-Wno-error=overflowed-literals"
     "-Wno-error=overlapping-patterns"
     "-Wno-error=partial-fields"
     "-Wno-error=partial-type-signatures"
     "-Wno-error=prepositive-qualified-module"
+    "-Wno-error=redundant-bang-patterns"
     "-Wno-error=redundant-constraints"
     "-Wno-error=redundant-record-wildcards"
     "-Wno-error=safe"
@@ -592,6 +619,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-error=type-defaults"
     "-Wno-error=typed-holes"
     "-Wno-error=unbanged-strict-patterns"
+    "-Wno-error=unicode-bidirectional-format-characters"
     "-Wno-error=unrecognised-pragmas"
     "-Wno-error=unrecognised-warning-flags"
     "-Wno-error=unsafe"
@@ -615,6 +643,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-hi-shadowing"
     "-Wno-identities"
     "-Wno-implicit-kind-vars"
+    "-Wno-implicit-lift"
     "-Wno-implicit-prelude"
     "-Wno-inaccessible-code"
     "-Wno-incomplete-patterns"
@@ -633,6 +662,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-missing-fields"
     "-Wno-missing-home-modules"
     "-Wno-missing-import-lists"
+    "-Wno-missing-kind-signatures"
     "-Wno-missing-local-signatures"
     "-Wno-missing-local-sigs"
     "-Wno-missing-methods"
@@ -646,12 +676,15 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-noncanonical-monad-instances"
     "-Wno-noncanonical-monadfail-instances"
     "-Wno-noncanonical-monoid-instances"
+    "-Wno-operator-whitespace"
+    "-Wno-operator-whitespace-ext-conflict"
     "-Wno-orphans"
     "-Wno-overflowed-literals"
     "-Wno-overlapping-patterns"
     "-Wno-partial-fields"
     "-Wno-partial-type-signatures"
     "-Wno-prepositive-qualified-module"
+    "-Wno-redundant-bang-patterns"
     "-Wno-redundant-constraints"
     "-Wno-redundant-record-wildcards"
     "-Wno-safe"
@@ -664,6 +697,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wno-type-defaults"
     "-Wno-typed-holes"
     "-Wno-unbanged-strict-patterns"
+    "-Wno-unicode-bidirectional-format-characters"
     "-Wno-unrecognised-pragmas"
     "-Wno-unrecognised-warning-flags"
     "-Wno-unsafe"
@@ -687,12 +721,15 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wnoncanonical-monadfail-instances"
     "-Wnoncanonical-monoid-instances"
     "-Wnot"
+    "-Woperator-whitespace"
+    "-Woperator-whitespace-ext-conflict"
     "-Worphans"
     "-Woverflowed-literals"
     "-Woverlapping-patterns"
     "-Wpartial-fields"
     "-Wpartial-type-signatures"
     "-Wprepositive-qualified-module"
+    "-Wredundant-bang-patterns"
     "-Wredundant-constraints"
     "-Wredundant-record-wildcards"
     "-Wsafe"
@@ -705,6 +742,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wtype-defaults"
     "-Wtyped-holes"
     "-Wunbanged-strict-patterns"
+    "-Wunicode-bidirectional-format-characters"
     "-Wunrecognised-pragmas"
     "-Wunrecognised-warning-flags"
     "-Wunsafe"
@@ -726,6 +764,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wwarn=all-missed-specialisations"
     "-Wwarn=all-missed-specializations"
     "-Wwarn=alternative-layout-rule-transitional"
+    "-Wwarn=ambiguous-fields"
     "-Wwarn=auto-orphans"
     "-Wwarn=compat"
     "-Wwarn=compat-unqualified-imports"
@@ -745,6 +784,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wwarn=hi-shadowing"
     "-Wwarn=identities"
     "-Wwarn=implicit-kind-vars"
+    "-Wwarn=implicit-lift"
     "-Wwarn=implicit-prelude"
     "-Wwarn=inaccessible-code"
     "-Wwarn=incomplete-patterns"
@@ -763,6 +803,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wwarn=missing-fields"
     "-Wwarn=missing-home-modules"
     "-Wwarn=missing-import-lists"
+    "-Wwarn=missing-kind-signatures"
     "-Wwarn=missing-local-signatures"
     "-Wwarn=missing-local-sigs"
     "-Wwarn=missing-methods"
@@ -776,12 +817,15 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wwarn=noncanonical-monad-instances"
     "-Wwarn=noncanonical-monadfail-instances"
     "-Wwarn=noncanonical-monoid-instances"
+    "-Wwarn=operator-whitespace"
+    "-Wwarn=operator-whitespace-ext-conflict"
     "-Wwarn=orphans"
     "-Wwarn=overflowed-literals"
     "-Wwarn=overlapping-patterns"
     "-Wwarn=partial-fields"
     "-Wwarn=partial-type-signatures"
     "-Wwarn=prepositive-qualified-module"
+    "-Wwarn=redundant-bang-patterns"
     "-Wwarn=redundant-constraints"
     "-Wwarn=redundant-record-wildcards"
     "-Wwarn=safe"
@@ -794,6 +838,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-Wwarn=type-defaults"
     "-Wwarn=typed-holes"
     "-Wwarn=unbanged-strict-patterns"
+    "-Wwarn=unicode-bidirectional-format-characters"
     "-Wwarn=unrecognised-pragmas"
     "-Wwarn=unrecognised-warning-flags"
     "-Wwarn=unsafe"
@@ -851,12 +896,14 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-XExplicitForAll"
     "-XExplicitNamespaces"
     "-XExtendedDefaultRules"
+    "-XFieldSelectors"
     "-XFlexibleContexts"
     "-XFlexibleInstances"
     "-XForeignFunctionInterface"
     "-XFunctionalDependencies"
     "-XGADTSyntax"
     "-XGADTs"
+    "-XGHC2021"
     "-XGHCForeignImportPrim"
     "-XGeneralisedNewtypeDeriving"
     "-XGeneralizedNewtypeDeriving"
@@ -926,6 +973,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-XNoExplicitForAll"
     "-XNoExplicitNamespaces"
     "-XNoExtendedDefaultRules"
+    "-XNoFieldSelectors"
     "-XNoFlexibleContexts"
     "-XNoFlexibleInstances"
     "-XNoForeignFunctionInterface"
@@ -969,6 +1017,8 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-XNoOverlappingInstances"
     "-XNoOverloadedLabels"
     "-XNoOverloadedLists"
+    "-XNoOverloadedRecordDot"
+    "-XNoOverloadedRecordUpdate"
     "-XNoOverloadedStrings"
     "-XNoPackageImports"
     "-XNoParallelArrays"
@@ -1015,6 +1065,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-XNoUndecidableInstances"
     "-XNoUndecidableSuperClasses"
     "-XNoUnicodeSyntax"
+    "-XNoUnliftedDatatypes"
     "-XNoUnliftedFFITypes"
     "-XNoUnliftedNewtypes"
     "-XNoViewPatterns"
@@ -1025,6 +1076,8 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-XOverlappingInstances"
     "-XOverloadedLabels"
     "-XOverloadedLists"
+    "-XOverloadedRecordDot"
+    "-XOverloadedRecordUpdate"
     "-XOverloadedStrings"
     "-XPackageImports"
     "-XParallelArrays"
@@ -1073,6 +1126,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-XUndecidableInstances"
     "-XUndecidableSuperClasses"
     "-XUnicodeSyntax"
+    "-XUnliftedDatatypes"
     "-XUnliftedFFITypes"
     "-XUnliftedNewtypes"
     "-XUnsafe"
@@ -1098,6 +1152,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-ddump-asm-regalloc-stages"
     "-ddump-asm-stats"
     "-ddump-bcos"
+    "-ddump-c-backend"
     "-ddump-call-arity"
     "-ddump-cfg-weights"
     "-ddump-cmm"
@@ -1128,6 +1183,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-ddump-ds-preopt"
     "-ddump-ec-trace"
     "-ddump-exitify"
+    "-ddump-faststrings"
     "-ddump-file-prefix"
     "-ddump-foreign"
     "-ddump-hi"
@@ -1162,6 +1218,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-ddump-splices"
     "-ddump-stg"
     "-ddump-stg-final"
+    "-ddump-stg-from-core"
     "-ddump-stg-unarised"
     "-ddump-str-signatures"
     "-ddump-stranal"
@@ -1239,6 +1296,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-dynhisuf"
     "-dynload"
     "-dyno"
+    "-dynohi"
     "-dynosuf"
     "-e"
     "-eventlog"
@@ -1265,10 +1323,12 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fcase-folding"
     "-fcase-merge"
     "-fcatch-bottoms"
+    "-fcheck-prim-bounds"
     "-fclear-plugins"
     "-fcmm-elim-common-blocks"
     "-fcmm-sink"
     "-fcmm-static-pred"
+    "-fcompact-unwind"
     "-fconstraint-solver-iterations"
     "-fcontext-stack"
     "-fcpr-anal"
@@ -1286,6 +1346,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fdiagnostics-show-caret"
     "-fdicts-cheap"
     "-fdicts-strict"
+    "-fdistinct-constructor-tables"
     "-fdmd-tx-dict-sel"
     "-fdo-eta-reduction"
     "-fdo-lambda-eta-expansion"
@@ -1297,10 +1358,12 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fexcess-precision"
     "-fexitification"
     "-fexpose-all-unfoldings"
+    "-fexpose-internal-symbols"
     "-fext-core"
     "-fextended-default-rules"
     "-fexternal-dynamic-refs"
     "-fexternal-interpreter"
+    "-ffamily-application-cache"
     "-fffi"
     "-ffi"
     "-fflat-cache"
@@ -1327,6 +1390,9 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fignore-optim-changes"
     "-fimplicit-params"
     "-fimplicit-prelude"
+    "-finfo-table-map"
+    "-finline-generics"
+    "-finline-generics-aggressively"
     "-firrefutable-tuples"
     "-fkeep-cafs"
     "-fkeep-going"
@@ -1372,6 +1438,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fno-case-folding"
     "-fno-case-merge"
     "-fno-catch-bottoms"
+    "-fno-check-prim-bounds"
     "-fno-cmm-elim-common-blocks"
     "-fno-cmm-sink"
     "-fno-cmm-static-pred"
@@ -1398,10 +1465,12 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fno-excess-precision"
     "-fno-exitification"
     "-fno-expose-all-unfoldings"
+    "-fno-expose-internal-symbols"
     "-fno-ext-core"
     "-fno-extended-default-rules"
     "-fno-external-dynamic-refs"
     "-fno-external-interpreter"
+    "-fno-family-application-cache"
     "-fno-ffi"
     "-fno-fi"
     "-fno-flat-cache"
@@ -1424,6 +1493,8 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fno-ignore-optim-changes"
     "-fno-implicit-params"
     "-fno-implicit-prelude"
+    "-fno-inline-generics"
+    "-fno-inline-generics-aggressively"
     "-fno-irrefutable-tuples"
     "-fno-keep-cafs"
     "-fno-keep-going"
@@ -1592,6 +1663,7 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-fprof-auto-exported"
     "-fprof-auto-top"
     "-fprof-cafs"
+    "-fprof-callers"
     "-fprof-count-entries"
     "-framework"
     "-framework-path"
@@ -1646,6 +1718,8 @@ This list should be updated by running 
`haskell-update-ghc-support'.")
     "-funbox-small-strict-fields"
     "-funbox-strict-fields"
     "-funclutter-valid-hole-fits"
+    "-funfolding-case-scaling"
+    "-funfolding-case-threshold"
     "-funfolding-creation-threshold"
     "-funfolding-dict-discount"
     "-funfolding-fun-discount"
diff --git a/haskell-indent.el b/haskell-indent.el
index afa558503b..a5316446b4 100644
--- a/haskell-indent.el
+++ b/haskell-indent.el
@@ -92,7 +92,6 @@
 
 (defvar haskell-literate)
 
-;;;###autoload
 (defgroup haskell-indent nil
   "Haskell indentation."
   :group 'haskell
@@ -435,7 +434,8 @@ Returns the location of the start of the comment, nil 
otherwise."
         (haskell-indent-skip-blanks-and-newlines-forward end))))
 
 (defun haskell-indent-next-symbol-safe (end)
-  "Puts point to the next following symbol, or to end if there are no more 
symbols in the sexp."
+  "Puts point if there are no more symbols in the sexp.
+The point is put to the next following symbol, or to end."
   (condition-case _errlist (haskell-indent-next-symbol end)
     (error (goto-char end))))
 
@@ -1233,7 +1233,7 @@ START if non-nil is a presumed start pos of the current 
definition."
                    (setq open (haskell-indent-offset-after-info)))
           (list (list (haskell-indent-after-keyword-column open start))))))
 
-     ;; open structure? ie  ( { [
+     ;; open structure? i.e.  ( { [
      ((setq open (haskell-indent-open-structure start (point)))
       (haskell-indent-inside-paren open))
 
@@ -1324,7 +1324,7 @@ of the regions to move."
 (defun haskell-indent-align-def (p-arg type)
   "Align guards or rhs within the current definition before point.
 If P-ARG is t align all defs up to the mark.
-TYPE is either 'guard or 'rhs."
+TYPE is either \\='guard or \\='rhs."
   (save-excursion
     (let (start-block end-block
                       (maxcol (if (eq type 'rhs) 
haskell-indent-rhs-align-column 0))
@@ -1435,7 +1435,7 @@ TYPE is either 'guard or 'rhs."
 
 (defun haskell-indent-align-guards-and-rhs (_start _end)
   "Align the guards and rhs of functions in the region, which must be active."
-  ;; The `start' and `end' args are dummys right now: they're just there so
+  ;; The `start' and `end' args are dummies right now: they're just there so
   ;; we can use the "r" interactive spec which properly signals an error.
   (interactive "*r")
   (haskell-indent-align-def t 'guard)
diff --git a/haskell-indentation.el b/haskell-indentation.el
index 8fb034ec9c..fb29107997 100644
--- a/haskell-indentation.el
+++ b/haskell-indentation.el
@@ -43,7 +43,6 @@
 (require 'cl-lib)
 (require 'haskell-lexeme)
 
-;;;###autoload
 (defgroup haskell-indentation nil
   "Haskell indentation."
   :link '(custom-manual "(haskell-mode)Indentation")
@@ -242,9 +241,9 @@ indentation points to the right, we switch going to the 
left."
   ;; try to repeat
   (when (not (haskell-indentation-indent-line-repeat))
     (setq haskell-indentation-dyn-last-direction nil)
-    ;; parse error is intentionally not cought here, it may come from
+    ;; parse error is intentionally not caught here, it may come from
     ;; `haskell-indentation-find-indentations', but escapes the scope
-    ;; and aborts the opertaion before any moving happens
+    ;; and aborts the operation before any moving happens
     (let* ((cc (current-column))
            (ci (haskell-indentation-current-indentation))
            (inds (save-excursion
@@ -794,7 +793,7 @@ For example
          (throw 'parse-end nil))))))
 
 (defun haskell-indentation-toplevel-where ()
-  "Parse 'where' that we may hit as a standalone in module declaration."
+  "Parse \\='where\\=' that we may hit as a standalone in module declaration."
   (haskell-indentation-read-next-token)
 
   (when (eq current-token 'end-tokens)
@@ -1161,13 +1160,13 @@ yet. Keep the list in ascending order."
 
 The following symbols are used as pseudo tokens:
 
-'layout-item: A new item in a layout list.  The next token
+\\='layout-item: A new item in a layout list.  The next token
               will be the first token from the item.
 
-'layout-end:  the end of a layout list.  Next token will be
+\\='layout-end:  the end of a layout list.  Next token will be
               the first token after the layout list.
 
-'end-tokens:  back at point where we started, following-token
+\\='end-tokens:  back at point where we started, following-token
               will be set to the next token.
 
 Pseudo tokens are used only when implicit-layout-active is
diff --git a/haskell-interactive-mode.el b/haskell-interactive-mode.el
index 0202fb35c6..63b5487876 100644
--- a/haskell-interactive-mode.el
+++ b/haskell-interactive-mode.el
@@ -48,9 +48,10 @@
   "Mark used for the old beginning of the prompt.")
 
 (defun haskell-interactive-prompt-regex ()
-  "Generate a regex for searching for any occurrence of the prompt\
-at the beginning of the line.  This should prevent any
-interference with prompts that look like haskell expressions."
+  "Generate a regex for searching whether prompt or not.
+The regex is for searching for any occurrence of the prompt at the beginning of
+the line.  This should prevent any interference with prompts that look like
+haskell expressions."
   (concat "^" (regexp-quote haskell-interactive-prompt)))
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -123,40 +124,33 @@ be nil.")
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Faces
 
-;;;###autoload
 (defface haskell-interactive-face-prompt
   '((t :inherit font-lock-function-name-face))
   "Face for the prompt."
   :group 'haskell-interactive)
 
-;;;###autoload
 (defface haskell-interactive-face-prompt-cont
   '((t :inherit font-lock-keyword-face))
   "Face for GHCi's prompt-cont in multi-line mode."
   :group 'haskell-interactive)
 
-;;;###autoload
 (define-obsolete-face-alias 'haskell-interactive-face-prompt2 
'haskell-interactive-face-prompt-cont "16.2")
 
-;;;###autoload
 (defface haskell-interactive-face-compile-error
   '((t :inherit compilation-error))
   "Face for compile errors."
   :group 'haskell-interactive)
 
-;;;###autoload
 (defface haskell-interactive-face-compile-warning
   '((t :inherit compilation-warning))
   "Face for compiler warnings."
   :group 'haskell-interactive)
 
-;;;###autoload
 (defface haskell-interactive-face-result
   '((t :inherit font-lock-string-face))
   "Face for the result."
   :group 'haskell-interactive)
 
-;;;###autoload
 (defface haskell-interactive-face-garbage
   '((t :inherit font-lock-string-face))
   "Face for trailing garbage after a command has completed."
@@ -402,7 +396,7 @@ SESSION, otherwise operate on the current buffer."
                           'rear-nonsticky t)))))
 
 (defun haskell-interactive-mode-goto-end-point ()
-  "Go to the 'end' of the buffer (before the prompt)."
+  "Go to the \\='end\\=' of the buffer (before the prompt)."
   (goto-char haskell-interactive-mode-prompt-start)
   (goto-char (line-beginning-position)))
 
diff --git a/haskell-lexeme.el b/haskell-lexeme.el
index 5b1998f3bb..a00838ce20 100644
--- a/haskell-lexeme.el
+++ b/haskell-lexeme.el
@@ -91,11 +91,11 @@ Using this function is more efficient than matching against 
the
 regexp `haskell-lexeme-qid-or-qsym'.
 
 Returns:
-  'qid - if matched a qualified id: 'Data.Map' or 'Map'
-  'qsym - if matched a qualified id: 'Monad.>>=' or '>>='
-  'qprefix - if matched only modid prefix: 'Data.'
+  \\='qid - if matched a qualified id: \\='Data.Map\\=' or \\='Map\\='
+  \\='qsym - if matched a qualified id: \\='Monad.>>=\\=' or \\='>>=\\='
+  \\='qprefix - if matched only modid prefix: \\='Data.\\='
 
-After successful 'qid or 'qsym match (match-string 1) will return
+After successful \\='qid or \\='qsym match (match-string 1) will return
 the unqualified part (if any)."
   (let ((begin (point))
         (match-data-old (match-data t)))
@@ -354,8 +354,8 @@ After successful match:
   "Non-nil when point is just in front of Template Haskell
 quaisquote literal.
 
-Quasi quotes start with '[xxx|' or '[$xxx|' sequence and end with
-  '|]'. The 'xxx' is a quoter name. There is no escaping mechanism
+Quasi quotes start with \\='[xxx|\\=' or \\='[$xxx|\\=' sequence and end with
+  \\='|]\\='. The \\='xxx\\=' is a quoter name. There is no escaping mechanism
 provided for the ending sequence.
 
 Regexp has subgroup expressions:
@@ -365,8 +365,8 @@ Regexp has subgroup expressions:
  (match-text 4) matches the closing vertical bar
                 or nil if at the end of the buffer.
 
-Note that this function excludes 'e', 't', 'd', 'p' as quoter
-names according to Template Haskell specification."
+Note that this function excludes \\='e\\=', \\='t\\=', \\='d'\\=, \\='p\\='
+as quoter names according to Template Haskell specification."
   (let ((match-data-old (match-data t)))
     (if (and
          (looking-at (rx-to-string `(: "[" (optional "$")
@@ -442,15 +442,17 @@ type of Haskell token recognized.  Use `match-string',
 result.
 
 Possible results are:
-- 'special: for chars [](){}`,;
-- 'comment: for single line comments
-- 'nested-comment: for multiline comments
-- 'qsymid: for qualified identifiers or symbols
-- 'string: for strings literals
-- 'char: for char literals
-- 'number: for decimal, float, hexadecimal and octal number literals
-- 'template-haskell-quote: for a string of apostrophes for template haskell
-- 'template-haskell-quasi-quote: for a string of apostrophes for template 
haskell
+- \\='special: for chars [](){}`,;
+- \\='comment: for single line comments
+- \\='nested-comment: for multiline comments
+- \\='qsymid: for qualified identifiers or symbols
+- \\='string: for strings literals
+- \\='char: for char literals
+- \\='number: for decimal, float, hexadecimal and octal number literals
+- \\='template-haskell-quote: for a string of apostrophes for template
+   haskell
+- \\='template-haskell-quasi-quote: for a string of apostrophes for template
+   haskell
 
 Note that for qualified symbols (match-string 1) returns the
 unqualified identifier or symbol.  Further qualification for
diff --git a/haskell-load.el b/haskell-load.el
index 7714ba7200..230d8f608a 100644
--- a/haskell-load.el
+++ b/haskell-load.el
@@ -130,7 +130,7 @@ actual Emacs buffer of the module being loaded."
                 process
                 "Failed, modules loaded: \\(.+\\)\\.$")
                nil)
-             ((haskell-process-consume
+              ((haskell-process-consume
                 process
                 "Failed, no modules loaded\\.$") ;; for ghc 8.4
                nil)
@@ -265,9 +265,9 @@ list of modules where missed IDENT was found."
                      (get-buffer-create "*haskell-process-log*"))
       (switch-to-buffer-other-window (get-buffer "*haskell-process-log*")))
      (t (let ((app-name (cl-ecase (haskell-process-type)
-                          ('ghci haskell-process-path-cabal)
-                          ('cabal-repl haskell-process-path-cabal)
-                          ('stack-ghci haskell-process-path-stack))))
+                          (ghci haskell-process-path-cabal)
+                          (cabal-repl haskell-process-path-cabal)
+                          (stack-ghci haskell-process-path-stack))))
           (haskell-process-queue-command
            process
            (make-haskell-command
@@ -336,7 +336,6 @@ list of modules where missed IDENT was found."
          (modules (and modules-string (split-string modules-string ", "))))
     (cons modules modules-string)))
 
-;;;###autoload
 (defface haskell-error-face
   '((((supports :underline (:style wave)))
      :underline (:style wave :color "#dc322f"))
@@ -345,7 +344,6 @@ list of modules where missed IDENT was found."
   "Face used for marking error lines."
   :group 'haskell-mode)
 
-;;;###autoload
 (defface haskell-warning-face
   '((((supports :underline (:style wave)))
      :underline (:style wave :color "#b58900"))
@@ -354,7 +352,6 @@ list of modules where missed IDENT was found."
   "Face used for marking warning lines."
   :group 'haskell-mode)
 
-;;;###autoload
 (defface haskell-hole-face
   '((((supports :underline (:style wave)))
      :underline (:style wave :color "#6c71c4"))
@@ -566,15 +563,15 @@ When MODULE-BUFFER is non-NIL, paint error overlays."
                  t)))))))
 
 (defun haskell-interactive-show-load-message (session type module-name 
file-name echo th)
-  "Show the '(Compiling|Loading) X' message."
+  "Show the \\='(Compiling|Loading) X\\=' message."
   (let ((msg (concat
               (cl-ecase type
-                ('compiling
+                (compiling
                  (if haskell-interactive-mode-include-file-name
                      (format "Compiling: %s (%s)" module-name file-name)
                    (format "Compiling: %s" module-name)))
-                ('loading (format "Loading: %s" module-name))
-                ('import-cycle
+                (loading (format "Loading: %s" module-name))
+                (import-cycle
                  (format "Module has an import cycle: %s" module-name)))
               (if th " [TH]" ""))))
     (haskell-mode-message-line msg)
diff --git a/haskell-mode.el b/haskell-mode.el
index c20e66ab28..0930680fb8 100644
--- a/haskell-mode.el
+++ b/haskell-mode.el
@@ -228,11 +228,8 @@ be set to the preferred literate style."
     "---"
     ["Load tidy core" ghc-core-create-core]
     "---"
-    ,(if (default-boundp 'eldoc-documentation-function)
-         ["Doc mode" eldoc-mode
-          :style toggle :selected (bound-and-true-p eldoc-mode)]
-       ["Doc mode" haskell-doc-mode
-        :style toggle :selected (and (boundp 'haskell-doc-mode) 
haskell-doc-mode)])
+    ["Doc mode" haskell-doc-mode
+     :style toggle :selected (and (boundp 'haskell-doc-mode) haskell-doc-mode)]
     ["Customize" (customize-group 'haskell)]
     ))
 
@@ -531,7 +528,7 @@ be set to the preferred literate style."
       (when (nth 4 ppss)
         ;; go to the end of a comment, there is nothing to see inside
         ;; a comment so we might as well just skip over it
-        ;; immediatelly
+        ;; immediately
         (setq ppss (parse-partial-sexp (point) (point-max) nil nil ppss
                                        'syntax-table)))
       (when (nth 8 ppss)
@@ -733,8 +730,6 @@ Prefix ARG is handled as per `delete-indentation'."
   (let ((fill-prefix (or fill-prefix (if (eq haskell-literate 'bird) ">"))))
     (delete-indentation arg)))
 
-(defvar eldoc-print-current-symbol-info-function)
-
 (defvar electric-pair-inhibit-predicate)
 (declare-function electric-pair-default-inhibit "elec-pair")
 (defun haskell-mode--inhibit-bracket-inside-comment-or-default (ch)
@@ -743,6 +738,26 @@ Prefix ARG is handled as per `delete-indentation'."
       (funcall #'electric-pair-default-inhibit ch)))
 
 ;; The main mode functions
+(defcustom haskell-mode-hook '(haskell-indentation-mode 
interactive-haskell-mode)
+  "List of functions to run after `haskell-mode' is enabled.
+
+Use to enable minor modes coming with `haskell-mode' or run an
+arbitrary function.
+
+Note that  `haskell-indentation-mode' and `haskell-indent-mode' should not be
+run at the same time."
+  :group 'haskell
+  :type 'hook
+  :options '(capitalized-words-mode
+             flyspell-prog-mode
+             haskell-decl-scan-mode
+             haskell-indent-mode
+             haskell-indentation-mode
+             highlight-uses-mode
+             imenu-add-menubar-index
+             interactive-haskell-mode
+             turn-on-haskell-unicode-input-method))
+
 ;;;###autoload
 (define-derived-mode haskell-mode prog-mode "Haskell"
   "Major mode for editing Haskell programs.
@@ -778,17 +793,18 @@ Other modes:
       Scans top-level declarations, and places them in a menu.
 
     `haskell-doc-mode', Hans-Wolfgang Loidl
-      Echoes types of functions or syntax of keywords when the cursor is idle.
+      Sets up eldoc to echo types of functions or syntax of keywords
+      when the cursor is idle.
 
 To activate a minor-mode, simply run the interactive command. For
 example, `M-x haskell-doc-mode'. Run it again to disable it.
 
-To enable a mode for every haskell-mode buffer, add a hook in
+To enable a mode for every `haskell-mode' buffer, add a hook in
 your Emacs configuration. To do that you can customize
 `haskell-mode-hook' or add lines to your .emacs file. For
 example, to enable `interactive-haskell-mode', use the following:
 
-    (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
+    (add-hook \\='haskell-mode-hook \\='interactive-haskell-mode)
 
 Minor modes that work well with `haskell-mode':
 
@@ -799,8 +815,8 @@ Minor modes that work well with `haskell-mode':
     (error "haskell-mode requires at least Emacs 25.1"))
 
   ;; paragraph-{start,separate} should treat comments as paragraphs as well.
-  (setq-local paragraph-start (concat " *{-\\| *-- |\\|" page-delimiter))
-  (setq-local paragraph-separate (concat " *$\\| *\\({-\\|-}\\) *$\\|" 
page-delimiter))
+  (setq-local paragraph-start (concat " *{-\\([^#]\\|$\\)\\| *-- |\\|" 
page-delimiter))
+  (setq-local paragraph-separate (concat " *$\\| 
*\\({-\\([^#]\\|$\\)\\|\\([^#]\\|^\\)-}\\) *$\\|" page-delimiter))
   (setq-local fill-paragraph-function 'haskell-fill-paragraph)
   ;; (setq-local adaptive-fill-function 'haskell-adaptive-fill)
   (setq-local comment-start "--")
@@ -812,8 +828,6 @@ Minor modes that work well with `haskell-mode':
   (setq-local parse-sexp-ignore-comments nil)
   (setq-local syntax-propertize-function #'haskell-syntax-propertize)
 
-  ;; Set things up for eldoc-mode.
-  (setq-local eldoc-documentation-function 'haskell-doc-current-info)
   ;; Set things up for imenu.
   (setq-local imenu-create-index-function 'haskell-ds-create-imenu-index)
   ;; Set things up for font-lock.
@@ -859,26 +873,6 @@ Minor modes that work well with `haskell-mode':
 
   (haskell-indentation-mode))
 
-(defcustom haskell-mode-hook '(haskell-indentation-mode 
interactive-haskell-mode)
-  "List of functions to run after `haskell-mode' is enabled.
-
-Use to enable minor modes coming with `haskell-mode' or run an
-arbitrary function.
-
-Note that  `haskell-indentation-mode' and `haskell-indent-mode' should not be
-run at the same time."
-  :group 'haskell
-  :type 'hook
-  :options '(capitalized-words-mode
-             flyspell-prog-mode
-             haskell-decl-scan-mode
-             haskell-indent-mode
-             haskell-indentation-mode
-             highlight-uses-mode
-             imenu-add-menubar-index
-             interactive-haskell-mode
-             turn-on-haskell-unicode-input-method))
-
 (defun haskell-fill-paragraph (justify)
   (save-excursion
     ;; Fill paragraph should only work in comments.
@@ -1142,7 +1136,8 @@ successful, nil otherwise."
  "2015-11-11")
 
 (defun haskell-mode-toggle-scc-at-point ()
-  "If point is in an SCC annotation, kill the annotation.  Otherwise, try to 
insert a new annotation."
+  "If point is in an SCC annotation, kill the annotation.
+Otherwise, try to insert a new annotation."
   (interactive)
   (if (not (haskell-mode-try-kill-scc-at-point))
       (if (not (haskell-mode-try-insert-scc-at-point))
@@ -1181,7 +1176,9 @@ Uses `haskell-guess-module-name-from-file-name'."
 
 (defvar haskell-auto-insert-module-format-string
   "-- | \n\nmodule %s where\n\n"
-  "Template string that will be inserted in new haskell buffers via 
`haskell-auto-insert-module-template'.")
+  "Template string for the `haskell-auto-insert-module-template' command.
+It will be inserted in new haskell buffers via
+`haskell-auto-insert-module-template'.")
 
 (defun haskell-auto-insert-module-template ()
   "Insert a module template for the newly created buffer."
diff --git a/haskell-move-nested.el b/haskell-move-nested.el
index c4a7bd5ae1..ba0b67e5eb 100644
--- a/haskell-move-nested.el
+++ b/haskell-move-nested.el
@@ -34,7 +34,9 @@
 
 ;;;###autoload
 (defun haskell-move-nested (cols)
-  "Shift the nested off-side-rule block adjacent to point by COLS columns to 
the right.
+  "Shift the nested off-side-rule block adjacent to point.
+It shift the nested off-side-rule block adjacent to point by COLS
+columns to the right.
 
 In Transient Mark mode, if the mark is active, operate on the contents
 of the region instead.
diff --git a/haskell-process.el b/haskell-process.el
index 2ca131f463..8a2ec940e0 100644
--- a/haskell-process.el
+++ b/haskell-process.el
@@ -77,7 +77,7 @@ Do not actually start any process.
 HPTYPE is the result of calling `'haskell-process-type`' function."
   (let ((session-name (haskell-session-name session)))
     (cl-ecase hptype
-      ('ghci
+      (ghci
        (append (list (format "Starting inferior GHCi process %s ..."
                              haskell-process-path-ghci)
                      session-name
@@ -86,7 +86,7 @@ HPTYPE is the result of calling `'haskell-process-type`' 
function."
                       (list
                        (append (haskell-process-path-to-list 
haskell-process-path-ghci)
                                haskell-process-args-ghci)))))
-      ('cabal-repl
+      (cabal-repl
        (append (list (format "Starting inferior `cabal repl' process using %s 
..."
                              haskell-process-path-cabal)
                      session-name
@@ -99,7 +99,7 @@ HPTYPE is the result of calling `'haskell-process-type`' 
function."
                         haskell-process-args-cabal-repl
                         (let ((target (haskell-session-target session)))
                           (if target (list target) nil)))))))
-      ('stack-ghci
+      (stack-ghci
        (append (list (format "Starting inferior stack GHCi process using %s" 
haskell-process-path-stack)
                      session-name
                      nil)
@@ -205,7 +205,8 @@ HPTYPE is the result of calling `'haskell-process-type`' 
function."
     t))
 
 (defun haskell-process-send-string (process string)
-  "Try to send a string to the process's process. Ask to restart if it's not 
running."
+  "Try to send a string to the process's process.
+Ask to restart if it's not running."
   (let ((child (haskell-process-process process)))
     (if (equal 'run (process-status child))
         (let ((out (concat string "\n")))
diff --git a/haskell-utils.el b/haskell-utils.el
index 1f1620e2b1..e28955f686 100644
--- a/haskell-utils.el
+++ b/haskell-utils.el
@@ -114,7 +114,7 @@ characters."
     (replace-regexp-in-string "\r?\n" "" s)))
 
 (defun haskell-utils-repl-response-error-status (response)
-  "Parse response REPL's RESPONSE for errors.
+  "Parse response REPL\\='s RESPONSE for errors.
 Returns one of the following symbols:
 
 + unknown-command
@@ -122,16 +122,16 @@ Returns one of the following symbols:
 + interactive-error
 + no-error
 
-*Warning*: this funciton covers only three kind of responses:
+*Warning*: this function covers only three kind of responses:
 
 * \"unknown command …\"
   REPL missing requested command
 * \"<interactive>:3:5: …\"
   interactive REPL error
-* \"Couldn't guess that module name. Does it exist?\"
+* \"Couldn\\='t guess that module name. Does it exist?\"
   (:type-at and maybe some other commands error)
 * *all other reposnses* are treated as success reposneses and
-  'no-error is returned."
+  \\='no-error is returned."
   (if response
       (let ((first-line (car (split-string response "\n" t))))
         (cond
diff --git a/haskell.el b/haskell.el
index a679b620f0..1b358051c9 100644
--- a/haskell.el
+++ b/haskell.el
@@ -446,9 +446,10 @@ Give optional NEXT-P parameter to override value of
                       (list "build --ghc-options=-fforce-recomp"))))))
 
 (defun haskell-process-file-loadish (command reload-p module-buffer)
-  "Run a loading-ish COMMAND that wants to pick up type errors\
-and things like that.  RELOAD-P indicates whether the notification
-should say 'reloaded' or 'loaded'.  MODULE-BUFFER may be used
+  "Run a loading-ish COMMAND.
+For example, a COMMAND that wants to pick up type errors and things like that.
+RELOAD-P indicates whether the notification
+should say \\='reloaded\\=' or \\='loaded\\='.  MODULE-BUFFER may be used
 for various things, but is optional."
   (let ((session (haskell-session)))
     (haskell-session-current-dir session)
diff --git a/inf-haskell.el b/inf-haskell.el
index e62b6ed869..6462db99f2 100644
--- a/inf-haskell.el
+++ b/inf-haskell.el
@@ -40,7 +40,6 @@
 (require 'cl-lib)
 (require 'haskell-string)
 
-;;;###autoload
 (defgroup inferior-haskell nil
   "Settings for REPL interaction via `inferior-haskell-mode'"
   :link '(custom-manual "(haskell-mode)inferior-haskell-mode")
@@ -56,14 +55,14 @@
   "Return the command with the arguments to start the repl based on the
 directory structure."
   (cl-ecase (haskell-process-type)
-    ('ghci       (cond ((eq system-type 'cygwin) `("ghcii.sh" 
,@haskell-process-args-ghci))
-                       (t (append
-                           (if (listp haskell-process-path-ghci)
-                               haskell-process-path-ghci
-                             (list haskell-process-path-ghci))
-                           haskell-process-args-ghci))))
-    ('cabal-repl `(,haskell-process-path-cabal "repl" 
,@haskell-process-args-cabal-repl))
-    ('stack-ghci `(,haskell-process-path-stack "ghci" 
,@haskell-process-args-stack-ghci))))
+    (ghci       (cond ((eq system-type 'cygwin) `("ghcii.sh" 
,@haskell-process-args-ghci))
+                      (t (append
+                          (if (listp haskell-process-path-ghci)
+                              haskell-process-path-ghci
+                            (list haskell-process-path-ghci))
+                          haskell-process-args-ghci))))
+    (cabal-repl `(,haskell-process-path-cabal "repl" 
,@haskell-process-args-cabal-repl))
+    (stack-ghci `(,haskell-process-path-stack "ghci" 
,@haskell-process-args-stack-ghci))))
 
 (defconst inferior-haskell-info-xref-re
   "-- Defined at \\(.+\\):\\([0-9]+\\):\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?$")
@@ -74,7 +73,8 @@ directory structure."
 
 (defvar inferior-haskell-multiline-prompt-re
   "^\\*?[[:upper:]][\\._[:alnum:]]*\\(?: \\*?[[:upper:]][\\._[:alnum:]]*\\)*| "
-  "Regular expression for matching multiline prompt (the one inside :{ ... :} 
blocks).")
+  "Regular expression for matching multiline prompt.
+the one inside :{ ... :} blocks.")
 
 (defconst inferior-haskell-error-regexp-alist
   `(;; Format of error messages used by GHCi.
diff --git a/tests/haskell-doc-tests.el b/tests/haskell-doc-tests.el
index 41010d7c32..37556ee3f0 100644
--- a/tests/haskell-doc-tests.el
+++ b/tests/haskell-doc-tests.el
@@ -44,13 +44,13 @@
     (forward-line)
     (should (string=
              "import [qualified] modid [as modid] [impspec]"
-             (haskell-doc-mode-print-current-symbol-info)))
+             (haskell-doc-eldoc-function)))
     (haskell-mode-toggle-interactive-prompt-state)
     (should (eq nil
-                   (haskell-doc-mode-print-current-symbol-info)))
+                (haskell-doc-eldoc-function)))
     (haskell-mode-toggle-interactive-prompt-state t)
     (should (string=
              "import [qualified] modid [as modid] [impspec]"
-             (haskell-doc-mode-print-current-symbol-info)))))
+             (haskell-doc-eldoc-function)))))
 
 ;;; haskell-doc-tests.el ends here
diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el
index 836cdcf1a0..a0f4836245 100644
--- a/tests/haskell-font-lock-tests.el
+++ b/tests/haskell-font-lock-tests.el
@@ -129,7 +129,7 @@
 
 (ert-deftest haskell-syntactic-test-18a-multiline ()
   "Backtick operators multiline"
-  ;; strangely thins works in interactive session
+  ;; strangely this works in interactive session
   :expected-result :failed
   (check-properties
    '(" `"
@@ -143,7 +143,7 @@
   "Syntax for hierarchical modules when on the first line."
   ;; note that quite many things here are not consistent but for now
   ;; this test describes what it is. When on the first column
-  ;; font-lock thins we are defining (.) operator. Not good.
+  ;; font-lock thinks we are defining (.) operator. Not good.
   :expected-result :failed
   (check-properties
    '("A1.B.C"
diff --git a/tests/haskell-mode-tests.el b/tests/haskell-mode-tests.el
index d31fe55704..47b8d8a133 100644
--- a/tests/haskell-mode-tests.el
+++ b/tests/haskell-mode-tests.el
@@ -666,4 +666,13 @@ moves over sexps."
          (goto-char (point-min))
          (should (looking-at-p "main = return ()")))))))
 
+(ert-deftest haskell-mode-add-language-pragma-with-existing-text ()
+  (with-temp-buffer
+    (haskell-mode)
+    (insert "module Main where\n")
+    (end-of-buffer)
+    (haskell-command-insert-language-pragma "ViewPatterns")
+    (should (string= (buffer-string)
+                     "{-# LANGUAGE ViewPatterns #-}\nmodule Main where\n"))))
+
 (provide 'haskell-mode-tests)
diff --git a/tests/haskell-utils-tests.el b/tests/haskell-utils-tests.el
index 75168244f1..50f2960598 100644
--- a/tests/haskell-utils-tests.el
+++ b/tests/haskell-utils-tests.el
@@ -222,7 +222,7 @@ removed."
   "Test commands related `haskell-utils-async-post-command-flag'.
 Tests flag updates and `post-command-hook' cleanup."
   (with-temp-switch-to-buffer
-    ;; set some random value to flag to test that it will be reseted
+    ;; set some random value to flag to test that it will be reset
     (setq haskell-utils-async-post-command-flag "non nil")
     (haskell-utils-async-watch-changes)
     ;; now flag should be empty
diff --git a/w3m-haddock.el b/w3m-haddock.el
index 141cbf4943..0f6a9e1190 100644
--- a/w3m-haddock.el
+++ b/w3m-haddock.el
@@ -35,7 +35,6 @@
 
 (add-hook 'w3m-display-hook 'w3m-haddock-display)
 
-;;;###autoload
 (defface w3m-haddock-heading-face
   '((((class color)) :inherit highlight))
   "Face for quarantines."
@@ -43,13 +42,15 @@
 
 (defcustom haskell-w3m-haddock-dirs
   '("~/.cabal/share/doc/")
-  "The path to your cabal documentation dir. It should contain
-directories of package-name-x.x.
+  "The path to your cabal documentation dir.
+It should contain directories of package-name-x.x.
 
 You can rebind this if you're using hsenv by adding it to your
 .dir-locals.el in your project root. E.g.
 
-    ((haskell-mode . ((haskell-w3m-haddock-dirs . 
(\"/home/chris/Projects/foobar/.hsenv/cabal/share/doc\")))))
+    ((haskell-mode .
+      ((haskell-w3m-haddock-dirs .
+        (\"/home/chris/Projects/foobar/.hsenv/cabal/share/doc\")))))
 
 "
   :group 'haskell



reply via email to

[Prev in Thread] Current Thread [Next in Thread]