Skip to content

Conversation

@jamesdbrock
Copy link
Contributor

Prevent ghc version mismatch between hdevtools and the project by using stack to invoke hdevtools instead of looking for hdevtools on the $PATH, to avoid issues such as hdevtools/hdevtools#78

Because hdevtools generally needs to be built with the same ghc version as the project being examined by hdevtools, there is no way to "install" a global hdevtools which works for all Haskell projects on a machine. And there is no way to solve this problem by changing hdevtools. stack and vim-hdevtools together can provide a nice solution to the problem of having a specially-built hdevtools for each project.

Possible problems or further work

Add a configuration option to disable stack.yaml detection?

@bitc
Copy link
Owner

bitc commented Nov 17, 2018

Thanks! I don't use stack, but I am willing to merge this eventually. First I want to wait a bit and maybe hear feedback from other people. As you say, the automatic stack.yaml detection in your patch may break things for existing users

@jamesdbrock jamesdbrock force-pushed the stack-aware branch 3 times, most recently from 8204ce8 to 4868f16 Compare November 18, 2018 15:20
@jamesdbrock
Copy link
Contributor Author

jamesdbrock commented Nov 18, 2018

Yeah, the automatic stack.yaml detection may break things for existing users. I just pushed another commit to the branch which requires users to explicitly opt-in by configuring .vimrc:

g:hdevtools_stack = 1

So if that configuration option is not set, then nothing changes. That should provide a smooth adoption path for this feature.

I've also got some other commits on this branch which make some orthogonal improvements to the README, I hope you don't mind.

@jamesdbrock
Copy link
Contributor Author

Do you want me to squash these stack feature commits together? What's the etiquette here, clean squashed commits or transparent work process with distinct commits?

@bitc
Copy link
Owner

bitc commented Nov 18, 2018

This repository is simple enough such that no formal process is needed. I think this pull requests looks good. Should I merge it right now?

If a `stack.yaml` file is found in the pwd, then hdevtools commands will
be invoked by `stack exec --package hdevtools hdevtools` instead
of `hdevtools`.

`hdevtools` must be built with the same version of GHC as the project
being inspected. With Stack support for vim-hdevtools, `hdevtools` will be
built with the same version of GHC referred to by the `stack.yaml`
resolver for the project, and `hdevtools` will be automatically installed
locally the first time a vim-hdevtools command is run.

Stack support must be enabled by `g:hdevtools_stack = 1`, otherwise
vim-hdevtools will revert to the usual behavior of always looking
for `hdevtools` in the `$PATH`. This will provide continuity for users who
would be surprised by the new behavior if they weren't expecting it.

In the future, perhaps Stack support could be enabled by default.
@jamesdbrock
Copy link
Contributor Author

I rebased and squashed the stack support commits and cleaned them up, ready to merge now. Thanks for maintaining this plugin @bitc !

@bitc bitc merged commit ab33578 into bitc:master Nov 19, 2018
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

Successfully merging this pull request may close these issues.

2 participants