 If PROMPT-OPTIONS is non-nil, prompt with an options list."
   (interactive "P")
   (save-buffer)
-  (let ((file (intero-buffer-file-name))
+  (let ((file (intero-temp-file-name))
         (repl-buffer (intero-repl-buffer prompt-options t)))
     (with-current-buffer repl-buffer
       (comint-simple-send

               (unless (member 'save flycheck-check-syntax-automatically)
                 (intero-async-call
                  'backend
                  (concat ":l " (intero-buffer-file-name))))
               (intero-async-call
                'backend
                ":set -fobject-code")

    (when name
      (intero-canonicalize-path (substring-no-properties name)))))

(defvar-local intero-temp-file-name nil
  "The name of a temporary file to which the current buffer's content is copied.")

(defun intero-temp-file-name (&optional buffer)
  "Return the name of a temp file containing an up-to-date copy of BUFFER's contents."
  (with-current-buffer (or buffer (current-buffer))
    (prog1
        (or intero-temp-file-name
            (setq intero-temp-file-name
                  (intero-canonicalize-path (make-temp-file "intero" nil ".hs"))))
      (let ((contents (buffer-string)))
        (with-temp-file intero-temp-file-name
          (insert contents))))))

(defun intero-canonicalize-path (path)
  "Return a standardized version of PATH.
Path names are standardised and drive names are
