atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Question: can this work with LTS 12/GHC 8.4.3? #240

Open marnen opened 5 years ago

marnen commented 5 years ago

ghc-mod master doesn’t work with GHC 8.4.3/Stack LTS 12, but according to https://github.com/DanielG/ghc-mod/issues/931 , there’s a branch that does. Any thoughts on how to get that version of ghc-mod working with Atom, or is that more of a stack install question?

lierdakil commented 5 years ago

Hi. To be honest, ghc-mod has been neglected for a while now. Pretty sure there are ways to make it work somewhat, but there can be no guarantees that it works as expected.

I've been meaning to jump ship to another backend provider, but it's a lot of work and I keep being distracted by other things (e.g. my day job), so I didn't manage to make much progress on that front. Sorry.

There is an option that should work reasonably well though. ide-haskell-repl has a (limited) backend provider mode, it can check for errors on save and show types on hover.

If you're feeling particularly adventurous, I've taken the branch you've mentioned and bashed it around until it compiled with LTS-12.something. No guarantees it works though. https://github.com/DanielG/ghc-mod/tree/lierdakil/ghc-8.4.3 You can build it with

git clone --recurse-submodules https://github.com/DanielG/ghc-mod -b lierdakil/ghc-8.4.3
cd ghc-mod
stack build

I didn't even run the tests though, pretty sure a lot of those will fail.

marnen commented 5 years ago

Thanks. I’ll try ide-haskell-repl, and maybe hack on that branch (though I’m not too skilled with Haskell yet).

lierdakil commented 5 years ago

Ok, cool.

FYI, I ran the tests, and most of those passed, surprisingly. Case Split doesn't seem to work at all though (but well, that much was almost certain)

marnen commented 5 years ago

Also, docs note: there’s nothing on the atom-haskell website that would let me know that ide-haskell-repl has the features you’ve described here. Perhaps that should be fixed?

lierdakil commented 5 years ago

Right.

lierdakil commented 5 years ago

Added a couple of paragraphs: https://atom-haskell.github.io/extra-packages/ide-haskell-repl/#using-ide-haskell-repl-as-ide-backend

Also updated some parts of ghc-mod-with-new-ghc warning here: https://atom-haskell.github.io/installation/installing-binary-dependencies/

If you think of something to add/change, feel free to create a PR (use the "edit this page" link at the top right corner of the corresponding website page)

marnen commented 5 years ago

Very useful—thanks so much!

marnen commented 5 years ago

Thanks again. Using the (new) existing instructions, I got ide-haskell working with -repl as backend (with stack docker: true!) without needing to specify any paths, and I’m getting warnings on save and hover type annotations. This is awesome.

cscalfani commented 5 years ago

Is there any way to cause the REPL to display warnings?

lierdakil commented 5 years ago

@cscalfani it will respect the same settings as ghc-mod if you're running it in a cabal project using the appropriate builder configuration (cabal/stack). If all else fails, adding {-# OPTIONS_GHC -Wall #-} should work.

cscalfani commented 5 years ago

Thanks. I really hate littering my code with GHC options (which does work BTW).

But setting the following does NOT:

image

Am I doing this correctly?

BTW, here is my other setting that may affect this:

image

lierdakil commented 5 years ago

Usually, people (myself included) just do something like this in the cabalfile:

ghc-options:     -Wall -fno-warn-unused-do-bind

But 'extra args' setting should work too, actually. Perhaps you just need to restart Atom for the setting to take effect?

EDIT: to clarify, changes in 'extra args' do not affect to already running GHCi instances; so, you have to restart those. And the easiest way to restart the background GHCi process is to restart Atom. Or, with recently released ide-haskell-repl 0.8.4, just killing GHCi process using OS tools will work too, it should restart automatically.

cscalfani commented 5 years ago

I just updated to 0.8.4 AND restarted Atom and putting -Wall in Extra Args works now.

Thank you for the help!