       (if (and (not quiet) bounds)
           (merlin-highlight bounds 'merlin-type-face)))))
 
-(defun merlin--type-region ()
+(defun merlin--type-region (k)
   "Show the type of the region."
   (lexical-let*
-      ((substring (merlin--buffer-substring (region-beginning) (region-end)))
-       (on-success (lambda (type) (merlin--type-display nil type nil)))
+      ((k k)
+       (substring (merlin--buffer-substring (region-beginning) (region-end)))
+       (on-success (lambda (type) (merlin--type-display nil type nil) (funcall k)))
        (on-error   (lambda (err)
                      (let ((msg (assoc 'message err))
                            (typ (assoc 'type err)))

                              (message "Error: the content of the region failed to parse."))
                             (msg (message "Error: %s" (cdr msg)))
			     (t
			      (message "Unexpected error")))))))
    (merlin--type-expression substring on-success on-error)))

(defun merlin-type-expr (exp)


(defun merlin--type-expression (exp callback-if-success &optional callback-if-exn)
  "Get the type of EXP inside the local context."
  (when exp (merlin-send-command-async
             (list 'type 'expression (substring-no-properties exp)
                   'at (merlin-unmake-point (point)))
             callback-if-success callback-if-exn)))

(defun merlin--type-display-in-buffer (text)
  "Change content of type-buffer."
