   (interactive)
   (th-insert-relevant-binding (funcall th-get-type-hole-info-function)))
 
-(defun th-resolve-hole-new-function(str &optional add-parens add-arg-holes)
+(defun th-resolve-hole-new-function (hole-str)
   (let* ((fn-name (read-string "Name for new function: "))
+         (hole-type (th--get-hole-type hole-str))
          (fn-with-type (concat fn-name
                                " :: "
-                               (th--get-hole-type str)
+                               hole-type
                                "\n"
                                fn-name
                                " = _")))
-    (th--replace-type-hole-dwim fn-with-type str)
+    (th--replace-type-hole-dwim fn-name hole-type)
     (funcall th-new-function-from-hole-position)
     (insert fn-with-type)
     (backward-char 1)

    (define-key map (kbd "C-c C-k C-b") 'th-resolve-hole-relevant-bindings-here)
    (define-key map (kbd "C-c C-k C-f") 'th-resolve-hole-new-function-here)
    (define-key map (kbd "C-c C-k C-t") 'th-toggle-type-hole-undefined-line)
    (define-key map (kbd "C-c C-k TAB") 'th-resolve-hole-prompt)
    map))

(defun th--get-type-hole-info-flycheck ()


(defun th--get-hole-type (str)
  "Get the type of the hole described by STR."
  (string-match (concat
                 "Found hole ‘_’\\(\n\s*\\)? with type: \\([\0-\377[:nonascii:]]*?\\)\n\s+?"
                 (rx (or "Where:" "Relevant bindings"))) str)
  (s-collapse-whitespace (replace-regexp-in-string "\n" "" (match-string 2 str))))

(defun th-insert-relevant-binding (str)
  (let* ((bindings (th-relevant-hole-bindings str))
         (hole-type (th--get-hole-type str))
         (binding (funcall completing-read-function
                           (format "Which binding for `%s'? " hole-type)
                           bindings)))
