Skip to content

Commit

Permalink
Show types for ambiguous type variables in the REPL, too
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdone committed May 10, 2014
1 parent a22f7a1 commit 7102355
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions haskell-interactive-mode.el
Expand Up @@ -39,6 +39,13 @@
:type 'boolean
:group 'haskell-interactive)

(defcustom haskell-interactive-types-for-show-ambiguous
t
"Show types when there's no Show instance or there's an
ambiguous class constraint."
:type 'boolean
:group 'haskell-interactive)

(defcustom haskell-interactive-mode-eval-pretty
nil
"Print eval results that can be parsed as Show instances prettily. Requires sexp-show (on Hackage)."
Expand Down Expand Up @@ -269,21 +276,20 @@ Key bindings:
(goto-char (point-max)))
(cond
((and (not (haskell-interactive-mode-line-is-query (elt state 2)))
(string-match "No instance for (?Show " response))
(or (string-match "No instance for (?Show " response)
(string-match "Ambiguous type variable " response)))
(haskell-process-reset (haskell-process))
(let ((resp (haskell-process-queue-sync-request
(haskell-process)
(concat "let it = "
(concat ":t "
(buffer-substring-no-properties
haskell-interactive-mode-prompt-start
(point-max))))))
(cond
((not (string-match "<interactive>:" resp))
(insert "\n"
(haskell-fontify-as-mode
(haskell-process-queue-sync-request
(haskell-process)
(concat ":t it"))
resp
'haskell-mode))
(haskell-interactive-mode-prompt))
(t (haskell-interactive-popup-error response)))))
Expand Down

0 comments on commit 7102355

Please sign in to comment.