diff --git a/elisp/ghc-info.el b/elisp/ghc-info.el index b21d7a1..4203bf7 100644 --- a/elisp/ghc-info.el +++ b/elisp/ghc-info.el @@ -87,17 +87,19 @@ (defun ghc-show-type0 (modname) (let* ((buf (current-buffer)) - (tinfos (ghc-type-get-tinfos modname)) - (tinfo (nth (ghc-type-get-ix) tinfos)) - (type (ghc-tinfo-get-info tinfo)) - (beg-line (ghc-tinfo-get-beg-line tinfo)) - (beg-column (ghc-tinfo-get-beg-column tinfo)) - (end-line (ghc-tinfo-get-end-line tinfo)) - (end-column (ghc-tinfo-get-end-column tinfo)) - (left (ghc-get-pos buf beg-line beg-column)) - (right (ghc-get-pos buf end-line end-column))) - (move-overlay ghc-type-overlay (- left 1) (- right 1) buf) - (message type))) + (tinfos (ghc-type-get-tinfos modname))) + (if (null tinfos) + (message "Cannot guess type") + (let* ((tinfo (nth (ghc-type-get-ix) tinfos)) + (type (ghc-tinfo-get-info tinfo)) + (beg-line (ghc-tinfo-get-beg-line tinfo)) + (beg-column (ghc-tinfo-get-beg-column tinfo)) + (end-line (ghc-tinfo-get-end-line tinfo)) + (end-column (ghc-tinfo-get-end-column tinfo)) + (left (ghc-get-pos buf beg-line beg-column)) + (right (ghc-get-pos buf end-line end-column))) + (move-overlay ghc-type-overlay (- left 1) (- right 1) buf) + (message type))))) (defun ghc-type-get-tinfos (modname) (if (= (ghc-type-get-point) (point))