 considered."
   (when (intero-completions-can-grab-prefix)
     (let ((prefix (cond
-                   ((intero-completions-grab-ghci-command))
                    ((intero-completions-grab-pragma-prefix))
                    ((intero-completions-grab-identifier-prefix)))))
       (cond ((and minlen prefix)

  (setq-local comint-prompt-regexp intero-prompt-regexp)
  (setq-local warning-suppress-types (cons '(undo discard-info) warning-suppress-types))
  (setq-local comint-prompt-read-only t)
  (add-hook 'completion-at-point-functions 'intero-completion-at-point nil t)
  (add-to-list (make-local-variable 'company-backends) 'intero-company)
  (company-mode))

(defun intero-repl-mode-start (backend-buffer targets prompt-options stack-yaml)

          (when completions
            (list beg end completions)))))))

(defun intero-repl-completion-at-point ()
  "A (blocking) function suitable for use in `completion-at-point-functions'.
Should only be used in the repl"
  (let* ((beg (save-excursion (intero-repl-beginning-of-line) (point)))
         (end (point))
         (str (buffer-substring-no-properties beg end))
         (repl-buffer (current-buffer))
         (proc (get-buffer-process (current-buffer))))
    (with-temp-buffer
      (comint-redirect-send-command-to-process
       (format ":complete repl %S" str) ;; command
       (current-buffer) ;; output buffer
       proc ;; target process
       nil  ;; echo
       t)   ;; no-display
      (while (not (with-current-buffer repl-buffer
                    comint-redirect-completed))
        (sleep-for 0.01))
      (let* ((completions (intero-completion-response-to-list (buffer-string)))
             (first-line (car completions)))
        (when (string-match "[^ ]* [^ ]* " first-line) ;; "2 2 :load src/"
          (setq first-line (replace-match "" nil nil first-line))
          (list (+ beg (length first-line)) end (cdr completions)))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Company integration (auto-completion)

