         write-contents-functions
         write-file-functions)
     (when (buffer-modified-p)
-      (basic-save-buffer))
-    nil))
+      ;; Supress message output.
+      (cl-letf (((symbol-function 'write-region) #'intero-silent-write-region))
+        (basic-save-buffer)))))
 
 (flycheck-define-generic-checker 'intero
   "A syntax and type checker for Haskell using an Intero worker

                                    nil
                                    (lambda (_st _))))))))))))

(defun intero-save-silently ()
  "Silently save the current buffer, if it is modified:

* Does not print messages.
* Does not trigger any hooks."
  (interactive)
  (let (; Attempts to disable messages:
        (inhibit-message t) ;; Introduced in Emacs 25
        message-log-max     ;; Introduced in Emacs 24.3
        ;; Canonical list of hooks taken from:
        ;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Saving-Buffers.html
        auto-save-hook
        require-final-newline

(defun eldoc-intero ()
  "ELDoc backend for intero."
  (let* ((ty (apply #'intero-get-type-at (intero-thing-at-point)))
         (is-error (string-match "^<.+>:.+:" ty)))
    (unless is-error
      (intero-fontify-expression (replace-regexp-in-string "[ \n]+" " " ty)))))

