Skip to content

Commit 8e29e23

Browse files
committed
Merge pull request #1347 from fice-t/set
Use :set +c in GHCi
2 parents 03622cb + 668425b commit 8e29e23

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

doc/haskell-mode.texi

+2-3
Original file line numberDiff line numberDiff line change
@@ -1226,10 +1226,9 @@ is bound to @code{haskell-goto-prev-error}
12261226
is bound to @code{haskell-goto-first-error}
12271227
@end table
12281228

1229-
@section Using GHCi-ng
1229+
@section Using GHCi 8+ or GHCi-ng
12301230

1231-
Put @code{:set +c} in your @code{.ghci} or run it in the REPL. Then use
1232-
these keybindings:
1231+
If you use either of the above, then you can use these functions:
12331232

12341233
@lisp
12351234
(define-key interactive-haskell-mode-map (kbd "M-.") 'haskell-mode-goto-loc)

haskell-commands.el

+8-6
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,12 @@ You can create new session using function `haskell-session-make'."
9393
:go (lambda (process)
9494
;; We must set the prompt last, so that this command as a
9595
;; whole produces only one prompt marker as a response.
96-
(haskell-process-send-string process "Prelude.putStrLn \"\"")
97-
(haskell-process-send-string process ":set -v1")
96+
(haskell-process-send-string process
97+
(mapconcat #'identity
98+
'("Prelude.putStrLn \"\""
99+
":set -v1"
100+
":set +c") ; :type-at in GHC 8+
101+
"\n"))
98102
(haskell-process-send-string process ":set prompt \"\\4\"")
99103
(haskell-process-send-string process (format ":set prompt2 \"%s\""
100104
haskell-interactive-prompt2)))
@@ -607,9 +611,7 @@ Query PROCESS to `:cd` to directory DIR."
607611
;;;###autoload
608612
(defun haskell-mode-show-type-at (&optional insert-value)
609613
"Show type of the thing at point or within active region asynchronously.
610-
This function requires GHCi-ng and `:set +c` option enabled by
611-
default (please follow GHCi-ng README available at URL
612-
`https://github.com/chrisdone/ghci-ng').
614+
This function requires GHCi 8+ or GHCi-ng.
613615
614616
\\<haskell-interactive-mode-map>
615617
To make this function works sometimes you need to load the file in REPL
@@ -650,7 +652,7 @@ happened since function invocation)."
650652
;; neither popup presentation buffer
651653
;; nor insert response in error case
652654
('unknown-command
653-
(message "This command requires GHCi-ng. Please read command description for details."))
655+
(message "This command requires GHCi 8+ or GHCi-ng. Please read command description for details."))
654656
('option-missing
655657
(message "Could not infer type signature. You need to load file first. Also :set +c is required. Please read command description for details."))
656658
('interactive-error (message "Wrong REPL response: %s" sig))

0 commit comments

Comments
 (0)