Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use REPL with stack? #953

Closed
mrkkrp opened this issue Oct 24, 2015 · 3 comments
Closed

How to use REPL with stack? #953

mrkkrp opened this issue Oct 24, 2015 · 3 comments

Comments

@mrkkrp
Copy link
Contributor

mrkkrp commented Oct 24, 2015

So I finally fully switched to stack. Now when I press C-c C-l and specify target, say tests, I get the following (after “Haskell process died” message):

The following target packages were not found: tests

What additional configuration/magic do I need to use to make REPL work with stack?

@mrkkrp
Copy link
Contributor Author

mrkkrp commented Oct 24, 2015

Fine, stack ghci uses different naming scheme for components of package. This explains the error message. Can you tell how haskell-mode decides what to use cabal repl or stack ghci and which arguments are passed to stack ghci, how they are generated?

Sorry, I'm usually having hard time reading source of some parts of haskell-mode.

@PierreR
Copy link
Contributor

PierreR commented Oct 24, 2015

This is what I use in my .spacemacs:

  (setq 
        ghc-ghc-options '("-fno-warn-missing-signatures")
        haskell-compile-cabal-build-command "cd %s && stack build"
        haskell-process-type 'stack-ghci
        haskell-interactive-popup-errors nil
        haskell-process-args-stack-ghci '("--ghc-options=-ferror-spans" "--with-ghc=ghci-ng")
        haskell-process-path-ghci "stack"
)

Of course you don't need the ghci-ng bit.

@mrkkrp
Copy link
Contributor Author

mrkkrp commented Oct 24, 2015

@PierreR, Thank you for sharing the config. haskell-process-type did the trick for me.

Tip for the maintainers: add a note about haskell-process-type to readme file along with other things that may need adjusting to work with Stack, this will definitely save time for some people.

Typing myproject:test:tests is still a bit long. Am I the only one who uses REPL with targets different from default? Previously haskell-mode had questions on loading by default, now I need to enable them manually, but anyway there are too many questions and no help (IDO or something would be great) to choose target. All this is disappointing.

I tried to read source code of haskell-mode to be in position to fix this stuff, but it feels like spaghetti or result of long-long accumulation of small changes without thinking about overall readability and design, so I gave up. No complaints, I appreciate that people maintain haskell-mode at all, just saying.

Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants