     (merlin-sync-to-point)
     (if (region-active-p)
         (merlin-type-region)
-      (if (merlin-type-enclosing-query)
-          (merlin-type-enclosing-go-up)))))
+      (when (merlin-type-enclosing-query)
+        (merlin-type-enclosing-go-up))))
+  (if merlin-arrow-keys-type-enclosing
+      (merlin-event-loop merlin-type-enclosing-map
+                         '((up . merlin-type-enclosing-go-up)
+                           (down . merlin-type-enclosing-go-down)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; PACKAGE, PROJECT AND FLAGS MANAGEMENT ;;

Note that works only if you use the default grouping function. If
you are using your own grouping function, you should include a
field logfile (see `merlin-start-process')"
  :group 'merlin :type 'filename)
;;;;;;;;;;;;;;;;;;;;;;;;
;; Internal variables ;;

    (setq merlin-enclosing-offset (1- merlin-enclosing-offset))
    (merlin-type-enclosing-go)))


(defvar merlin-type-enclosing-map
  (let ((keymap (make-sparse-keymap)))
    (define-key keymap (kbd "<up>") 'up)
    (define-key keymap (kbd "[up]") 'up)
    (define-key keymap (kbd "<down>") 'down)
    (define-key keymap (kbd "[down]") 'down)
    keymap)
  "The local map to navigate type enclosing.")

(defun merlin-type-enclosing ()
  "Print the type of the expression under point (or of the region, if it exists)."
  (interactive)
