Skip to content

Commit 4c3cdfd

Browse files
committed
Merge pull request #746 from johnwalker/stack-ghci
Add support for interaction with stack ghci.
2 parents dbd8578 + 4ed4dac commit 4c3cdfd

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

haskell-customize.el

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Used for locating additional package data files.")
4444
(defcustom haskell-process-type
4545
'auto
4646
"The inferior Haskell process type to use."
47-
:type '(choice (const auto) (const ghci) (const cabal-repl) (const cabal-ghci))
47+
:type '(choice (const auto) (const ghci) (const cabal-repl) (const cabal-ghci) (const stack-ghci))
4848
:group 'haskell-interactive)
4949

5050
(defcustom haskell-process-wrapper-function
@@ -110,6 +110,12 @@ when showing type information about symbols."
110110
:group 'haskell-interactive
111111
:type '(choice string (repeat string)))
112112

113+
(defcustom haskell-process-path-stack
114+
"stack"
115+
"The path for starting stack."
116+
:group 'haskell-interactive
117+
:type '(choice string (repeat string)))
118+
113119
(defcustom haskell-process-args-ghci
114120
'("-ferror-spans")
115121
"Any arguments for starting ghci."
@@ -118,7 +124,7 @@ when showing type information about symbols."
118124

119125
(defcustom haskell-process-args-cabal-repl
120126
'("--ghc-option=-ferror-spans")
121-
"Additional arguments to for `cabal repl' invocation.
127+
"Additional arguments for `cabal repl' invocation.
122128
Note: The settings in `haskell-process-path-ghci' and
123129
`haskell-process-args-ghci' are not automatically reused as `cabal repl'
124130
currently invokes `ghc --interactive'. Use
@@ -128,6 +134,12 @@ pass additional flags to `ghc'."
128134
:group 'haskell-interactive
129135
:type '(repeat (string :tag "Argument")))
130136

137+
(defcustom haskell-process-args-stack-ghci
138+
'("--ghc-options=-ferror-spans")
139+
"Additional arguments for `stack ghci' invocation."
140+
:group 'haskell-interactive
141+
:type '(repeat (string :tag "Argument")))
142+
131143
(defcustom haskell-process-do-cabal-format-string
132144
":!cd %s && %s"
133145
"The way to run cabal comands. It takes two arguments -- the directory and the command.

haskell-process.el

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,18 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
104104
session-name
105105
nil)
106106
(apply haskell-process-wrapper-function
107-
(list (list haskell-process-path-cabal-ghci))))))))
107+
(list (list haskell-process-path-cabal-ghci)))))
108+
('stack-ghci
109+
(append (list (format "Starting inferior stack GHCi process using %s" haskell-process-path-stack)
110+
session-name
111+
nil)
112+
(apply haskell-process-wrapper-function
113+
(list
114+
(append
115+
(list haskell-process-path-stack "ghci")
116+
(let ((target (haskell-session-target session)))
117+
(if target (list target) nil))
118+
haskell-process-args-stack-ghci))))))))
108119

109120
(defun haskell-process-make (name)
110121
"Make an inferior Haskell process."

0 commit comments

Comments
 (0)