 ;  () if this node does not correspond to an annotated interval
 ;  (type-start . type-end)  address of the annotation in the .annot file
 
+(defun caml-types-hcons (elem table)
+  (or (cl-gethash elem table) (cl-puthash elem elem table) elem))
+      
+
 (defun caml-types-build-tree (target-file)
   (let ((stack ())
         (accu ())
+        (table (make-hash-table :test 'equal))
         (type-info ()))
     (while (re-search-forward caml-types-location-re () t)
       (let ((l-file (file-name-nondirectory (match-string 1)))

         (target-file (file-name-nondirectory (buffer-file-name)))
         (type-file (concat (file-name-sans-extension (buffer-file-name))
                            ".annot"))
         (type-buf (caml-types-find-file type-file))
         (target-line) (target-bol)
         target-pos
         Left Right limits cnum node mes ty-start ty-end
         (tree caml-types-annotation-tree)
         )
    (caml-types-preprocess type-file type-buf)
    ; (message "Drag the mouse to explore types")
    (unwind-protect
        (track-mouse

                  (move-overlay caml-types-expr-ovl Left Right target-buf)
                  (setq limits (caml-types-find-interval target-buf target-pos
                                                         node))
                  (setq type (elt node 2))
                  )
                 (t
                  (delete-overlay caml-types-expr-ovl)
                  (setq type "*no type information*")
                  (setq limits (caml-types-find-interval target-buf target-pos
                                                         tree))
                  ))
                (message (format "type: %s" type))
                (insert type)
                ))
              (setq event (read-event))
              (unless (mouse-movement-p event) (setq event nil))
            )
