diff --git a/haskell-customize.el b/haskell-customize.el index 869311eb2..1ab691122 100644 --- a/haskell-customize.el +++ b/haskell-customize.el @@ -44,7 +44,7 @@ Used for locating additional package data files.") (defcustom haskell-process-type 'auto "The inferior Haskell process type to use." - :type '(choice (const auto) (const ghci) (const cabal-repl) (const cabal-ghci)) + :type '(choice (const auto) (const ghci) (const cabal-repl) (const cabal-ghci) (const stack-ghci)) :group 'haskell-interactive) (defcustom haskell-process-wrapper-function @@ -110,6 +110,12 @@ when showing type information about symbols." :group 'haskell-interactive :type '(choice string (repeat string))) +(defcustom haskell-process-path-stack + "stack" + "The path for starting stack." + :group 'haskell-interactive + :type '(choice string (repeat string))) + (defcustom haskell-process-args-ghci '("-ferror-spans") "Any arguments for starting ghci." @@ -118,7 +124,7 @@ when showing type information about symbols." (defcustom haskell-process-args-cabal-repl '("--ghc-option=-ferror-spans") - "Additional arguments to for `cabal repl' invocation. + "Additional arguments for `cabal repl' invocation. Note: The settings in `haskell-process-path-ghci' and `haskell-process-args-ghci' are not automatically reused as `cabal repl' currently invokes `ghc --interactive'. Use @@ -128,6 +134,12 @@ pass additional flags to `ghc'." :group 'haskell-interactive :type '(repeat (string :tag "Argument"))) +(defcustom haskell-process-args-stack-ghci + '("--ghc-options=-ferror-spans") + "Additional arguments for `stack ghci' invocation." + :group 'haskell-interactive + :type '(repeat (string :tag "Argument"))) + (defcustom haskell-process-do-cabal-format-string ":!cd %s && %s" "The way to run cabal comands. It takes two arguments -- the directory and the command. diff --git a/haskell-process.el b/haskell-process.el index c0c28cd5a..e9bc1a7bf 100644 --- a/haskell-process.el +++ b/haskell-process.el @@ -104,7 +104,18 @@ HPTYPE is the result of calling `'haskell-process-type`' function." session-name nil) (apply haskell-process-wrapper-function - (list (list haskell-process-path-cabal-ghci)))))))) + (list (list haskell-process-path-cabal-ghci))))) + ('stack-ghci + (append (list (format "Starting inferior stack GHCi process using %s" haskell-process-path-stack) + session-name + nil) + (apply haskell-process-wrapper-function + (list + (append + (list haskell-process-path-stack "ghci") + (let ((target (haskell-session-target session))) + (if target (list target) nil)) + haskell-process-args-stack-ghci)))))))) (defun haskell-process-make (name) "Make an inferior Haskell process."