                (save-excursion
                  (goto-char (point-min))
                  (forward-line (1- (plist-get suggestion :line)))
-                 (if (search-forward-regexp "\\([[:space:]]*::\\|instance\\)[[:space:]]* (?\\([[:alnum:][:space:],?\n]+\\))?[[:space:]?\n]*=>" (point-max) t)
-                     (let* ((start (match-beginning 2))
-                            (end (match-end 2))
-                            (constraints
-                             (mapcar #'string-trim
-                                     (split-string (match-string 2)
-                                                   "[[:space:]]*,[[:space:]]*")))
-                            (nonredundant
-                             (cl-loop for r in (plist-get suggestion :redundancies)
-                                      with nonredundant = constraints
-                                      do (setq nonredundant (delete r nonredundant))
-                                      finally return nonredundant)))
-                       (goto-char start)
-                       (delete-char (- end start))
-                       (insert (string-join nonredundant ", ")))
-                   (message "Couldn't parse constraints"))))))
-
+                 (search-forward-regexp "[[:alnum:][:space:]\n]*=>")
+                 (backward-sexp 2)
+                 (let ((start (1+ (point))))
+                   (forward-sexp)
+                   (let* ((end (1- (point)))
+                          (constraints (intero-parse-comma-list
+                                        (buffer-substring start end)))
+                          (nonredundant
+                             (loop for r in (plist-get suggestion :redundancies)
+                                   with nonredundant = constraints
+                                   do (setq nonredundant (delete r nonredundant))
+                                   finally return nonredundant)))
+                     (goto-char start)
+                     (delete-char (- end start))
+                     (insert (string-join nonredundant ", "))))))))
 
         ;; Add a type signature to a top-level binding.
         (cl-loop


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Auto actions

(defun intero-apply-suggestions ()
  "Prompt and apply the suggestions."

          ;;                             Functor var,
          ;;                             Applicative var,
          ;;                             Monad var)
          (when (string-match "Redundant constraints?: " text)
            (let* ((redundant-start (match-end 0))
                   (parts (with-temp-buffer
                            (insert (substring text redundant-start))
                            (goto-char (point-min))
                            ;; A lone unparenthesized constraint might
                            ;; be multiple sexps.
                            (while (not (eq (point) (point-at-eol)))
                              (forward-sexp))
                            (let ((redundant-end (point)))
                              (search-forward-regexp ".*\n.*In the ")
                              (cons (buffer-substring (point-min) redundant-end)
                                    (buffer-substring (match-end 0) (point-max)))))))
              (setq note t)
              (add-to-list
               'intero-suggestions
               (let ((rest (cdr parts))
                     (redundant (let ((raw (car parts)))
                                  (if (eq (string-to-char raw) ?\()
                                      (substring raw 1 (1- (length raw)))
                                    raw))))
                 (list :type 'redundant-constraint
                       :redundancies (mapcar #'string-trim
                                             (intero-parse-comma-list redundant))
                       :signature (mapconcat #'identity (split-string rest) " ")
                       :line (flycheck-error-line msg))))))
          ;; Add a note if we found a suggestion to make
          (when note
            (setf (flycheck-error-message msg)
