syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

haskell-layer seems to be getting confused between cabal and stack #12482

Closed saurabhnanda closed 3 years ago

saurabhnanda commented 5 years ago

Description :octocat:

It seems that spacemacs/haskell-layer is getting confused between using stack or cabal. I'm constantly getting the following error while typing in a haskell buffer:

Suspicious state from syntax checker haskell-stack-ghc: Flycheck checker haskell-stack-ghc returned non-zero exit code 1, but its output container no error: : cannot satisfy -package HaskellNet (use -v for more information)

Similarly, trying to use C-c C-l to start a REPL session resulted in a "this package has never been configured" error via Cabal.

I had ghc installed in a global location (presumably via Haskell Platform). I used uninstall-hsto get rid of it. Now, when I do a C-c C-l I get the following error:

Package has never been configured. Configuring with default flags. If this fails, please run configure manually. cabal: The program 'ghc' version >=6.4 is required but it could not be found.

I've tried various combinations of the following config, but the problem persists:

((haskell :variables haskell-process-type 'stack-ghci haskell-process-args-ghci "ghci" haskell-process-path-ghci "stack"))

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: Already mentioned above.

Expected behaviour: :heart: :smile: If my analysis is correct, and my understanding of the docs is correct, then haskell-layer should be able to automatically figure out the correct commands/binaries to execute depending upon whether the current buffer belongs to a stack project or a cabal project.

System Info :computer:

Backtrace :paw_prints:

Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
cabal: The program 'ghc' version >=6.4 is required but it could not be found.
saurabhnanda commented 5 years ago

Possibly related to https://github.com/syl20bnr/spacemacs/issues/10593 or https://github.com/syl20bnr/spacemacs/issues/7953

duianto commented 5 years ago

This probably isn't related but you have haskell defined twice in your layers list:

(haskell ansible nginx markdown ivy elm html yaml javascript sql emacs-lisp syntax-checking auto-completion-packages purescript
         ((haskell :variables haskell-process-type 'stack-ghci haskell-process-args-ghci "ghci" haskell-process-path-ghci "stack"))
         osx)

When I try to define the layer with variables and the second set of parentheses, then I get this error message on startup:

  • Unknown layer (haskell :variables haskell-process-type (quote stack-ghci) haskell-process-args-ghci ghci haskell-process-path-ghci stack) declared in dotfile.

Back to the issue

I don't know much about haskell or flycheck, but it might be working as expected on the develop branch.

With the layer defined as just haskell or with your suggested layer variables (without the extra surrounding parentheses):

(haskell :variables haskell-process-type 'stack-ghci haskell-process-args-ghci "ghci" haskell-process-path-ghci "stack")

When I open an example file:

-- https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/Simple%20examples

import System.Info

main = do
    print os
    print arch
    print compilerName
    print compilerVersion

and press C-c C-l, then a *haskell* buffer opens saying:

Hours of hacking await!
If I break, you can:
  1. Restart:           M-x haskell-process-restart
  2. Configure logging: C-h v haskell-process-log (useful for debugging)
  3. General config:    M-x customize-mode
  4. Hide these tips:   C-h v haskell-process-show-debug-tips
λ> 

System Info :computer:

dmp1ce commented 5 years ago

The same thing is occurring for me when I use haskell-stack-ghc checker instead of intero.

Suspicious state from syntax checker haskell-stack-ghc: Flycheck checker haskell-stack-ghc returned non-zero exit code 1, but its output contained no errors: <command line>: cannot satisfy -package tasty
    (use -v for more information)

Try installing a more recent version of haskell-stack-ghc, and please open a bug report if the issue persists in the latest release.  Thanks!
schell commented 5 years ago

@dmp1ce I was seeing the same problem except instead of not being able to satisfy tasty mine couldn't satisfy hspec. I don't know why but it seems it was looking for the test dependencies. Running stack test in the project directory downloaded and built those deps/artifacts, and now it works for me. Good luck!

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!