          (plist-get state :source-buffer)
        (funcall
         (plist-get state :cont)
-        (if (string-match "^*** Exception" reply)
-            (list)
-          (mapcar
-           (lambda (x)
-             (replace-regexp-in-string "\\\"" "" x))
-           (split-string reply "\n" t))))))))
+        (intero-completion-response-to-list reply))))))
+
+(defun intero-completion-response-to-list (reply)
+  "Convert the REPLY from a backend completion to a list."
+  (if (string-match "^*** Exception" reply)
+      (list)
+    (mapcar
+     (lambda (x)
+       (replace-regexp-in-string "\\\"" "" x))
+     (split-string reply "\n" t))))
 
 (defun intero-get-repl-completions (source-buffer prefix cont)
   "Get REPL completions and send to SOURCE-BUFFER.

  "In BUFFER, call FUNC with ARGS."
  (with-current-buffer buffer
    (apply func args)))

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

  (if intero-mode
      (progn (flycheck-select-checker 'intero)
             (flycheck-mode)
             (add-hook 'completion-at-point-functions 'intero-completion-at-point nil t)
             (add-to-list (make-local-variable 'company-backends) 'intero-company)
             (company-mode)
             (setq-local eldoc-documentation-function 'intero-eldoc))
