     (if insert
         (save-excursion
           (goto-char (line-beginning-position))
-          (insert
-           (format "%s\n"
-                   (with-temp-buffer
-                     (when (fboundp 'haskell-mode)
-                       (haskell-mode))
-                     (insert ty)
-                     (font-lock-fontify-buffer)
-                     (buffer-string)))))
+          (insert (intero-fontify-expression ty) "\n"))
       (message
-       "%s"
-       (with-temp-buffer
-         (when (fboundp 'haskell-mode)
-           (haskell-mode))
-         (insert ty)
-         (font-lock-fontify-buffer)
-         (buffer-string))))))
+       "%s" (intero-fontify-expression ty)))))
 
 (defun intero-info (ident)
   "Get the info of the thing at point."

        (with-help-window (help-buffer)
          (with-current-buffer (help-buffer)
            (insert
             (with-temp-buffer
               (when (fboundp 'haskell-mode)
                 (haskell-mode))
               (insert ident)
               (font-lock-fontify-buffer)
               (buffer-string))
             " in `"
             origin
             "'"
             " (" package ")"
             "\n\n"
             (with-temp-buffer
               (when (fboundp 'haskell-mode)
                 (haskell-mode))
               (insert info)
               (font-lock-fontify-buffer)
               (buffer-string)))
            (goto-char (point-min))))))))

(defun intero-goto-definition ()

   (concat ":cd "
           (read-directory-name "Change Intero directory: "))))

(defun intero-fontify-expression (expression)
  "Return a haskell-fontified version of EXPRESSION."
  (with-temp-buffer
    (when (fboundp 'haskell-mode)
      (haskell-mode))
    (insert expression)
    (if (fboundp 'font-lock-ensure)
        (font-lock-ensure)
      (font-lock-fontify-buffer))
    (buffer-string)))

(defun intero-type-at (insert)
  "Get the type of the thing or selection at point.

