You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this doesn't work because haskell-build-type in haskell-customize.el looks for a cabalcabal.projectstack file and an executable on path:
(defun haskell-build-type ()
"Looks for cabal and stack spec files.
When found, returns a pair (TAG . DIR)
where TAG is 'cabal-project, 'cabal-sandbox. 'cabal, or 'stack;
and DIR is the directory containing cabal or stack file.
When none found, DIR is nil, and TAG is 'ghc"
;; REVIEW maybe just 'cabal is enough.
(let ((cabal-project (locate-dominating-file default-directory "cabal.project"))
(cabal-sandbox (locate-dominating-file default-directory "cabal.sandbox.config"))
(stack (locate-dominating-file default-directory "stack.yaml"))
(cabal (locate-dominating-file
default-directory
(lambda (d)
(cl-find-if
(lambda (f) (string-match-p ".\\.cabal\\'" f))
(directory-files d))))))
(cond
((and cabal-project (executable-find "cabal"))
(cons 'cabal-project cabal-project))
((and cabal-sandbox (executable-find "cabal"))
(cons 'cabal-sandbox cabal-sandbox))
((and stack (executable-find "stack"))
(cons 'stack stack))
((and cabal (executable-find "cabal")) ;; <---------------------------------------------- right here
(cons 'cabal cabal))
((executable-find "ghc") (cons 'ghc nil))
(t (error "Could not find any installation of GHC.")))))
This means that when I try run-haskell or haskell-process-load-file I get Could not find any installation of GHCeven thoughghccabal and friends are accessible from my nix shell.
So to summarize:
the current implementation of haskell-build-typeassumes I have stack or cabal globally installed.
However, the user could not have these globally installed and instead choose to provide them in a nix shell. In this scenario haskell-build-type does not realize this and prematurely errors out, even though if it ran inside the nix shell everything would be fine.
So I think there are two paths forward:
add .nix files to the cond expression in haskell-build-type, or
detect if haskell-process-wrapper-function is set, if so run executable-find "foo"` through that.
I think 2 likely makes more sense.
The text was updated successfully, but these errors were encountered:
This is not a bug but a missed edge case, the problem is:
flake.nix
andshell.nix
and friends in root directories of project.Now the traditional way to run
inferior-haskell-process
is withhaskell-process-wrapper
like so (this uses thenix-sandbox
emacs package):However, this doesn't work because
haskell-build-type
inhaskell-customize.el
looks for acabal
cabal.project
stack
file and an executable on path:This means that when I try
run-haskell
orhaskell-process-load-file
I getCould not find any installation of GHC
even thoughghc
cabal
and friends are accessible from my nix shell.So to summarize:
haskell-build-type
assumes I havestack
orcabal
globally installed.haskell-build-type
does not realize this and prematurely errors out, even though if it ran inside the nix shell everything would be fine.So I think there are two paths forward:
.nix
files to thecond
expression inhaskell-build-type
, orhaskell-process-wrapper-function is set, if so run
executable-find "foo"` through that.I think 2 likely makes more sense.
The text was updated successfully, but these errors were encountered: