                             "--verbosity" "silent"))
             (buffer-substring (line-beginning-position) (line-end-position))))))
 
+(defun intero-get-targets ()
+  "Get all available targets."
+  (with-temp-buffer
+    (cl-case (call-process "stack" nil (current-buffer) t "ide" "targets")
+      (0
+       (split-string (buffer-string) nil t))
+      (1 nil))))
+
 (defun intero-package-name (&optional cabal-file)
   "Get the current package name from a nearby .cabal file. If
 there is none, return empty string."

(defun intero-targets ()
  "Set the targets to use for stack ghci."
  (interactive)
  (let ((targets (split-string (read-from-minibuffer "Targets: ")
                               " "
                               t)))
    (intero-destroy)
    (intero-get-worker-create 'backend targets (current-buffer))))


                       :notify (lambda (widget &rest ignore)
                                 (setq choices
                                       (mapcar (lambda (choice)
                                                 (if (equal (plist-get choice :key)
                                                            (plist-get (cdr widget) :key))
                                                     (plist-put choice :value (plist-get (cdr widget) :value))
                                                   choice))
                                               choices)))
                       :on (concat "[x] " (plist-get option :title))
                       :off (concat "[ ] " (plist-get option :title))
                       :value (plist-get option :default)
                       :key (plist-get option :key)))
          (let ((lines (line-number-at-pos)))
            (select-window (split-window-below (- 0 (max window-min-height (1+ lines)))))
