-
-
Notifications
You must be signed in to change notification settings - Fork 391
Download required haskell toolchain via ghcup in hls-wrapper #2251
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
Comments
I can only speak for myself, but one of the reasons ghcup was written is that people disliked the automatic downloading of GHC versions from stack. If IMO, tools work best if there's a tree-style hierarchy: e.g. you wouldn't expect This could be another use case for hooks: if you start HLS and the required GHC version is missing, execute a given shell script with certain environment variables set. Similar to what I did for stack. |
Possible caveats:
|
But we will have to take the decision if we use a default hook doing the installs, the difference would be you allow advanced user to implement its own hook (and no use ghcup for example 😝 ). The drawback is you have the code written in bash (and powershell if msys2 is not available) instead haskell. That feature is oriented to beginners as advanced users will have probably all the toolchain installed Another option is make it opt in instead opt out. Will add a config option in the vscode extension anyways.
but hls will not call ghcup, hls-wrapper will do so the graph would be hls-wrapper -> ghcup -> hls. We will use the existing ghcup to do it so it would be a handy shortcut in that case. |
That's not a drawback for hooks. It's much simpler, because it doesn't need recompilation if you change a single line. Also, hooks are usually low complexity, there's little advantage in using haskell for this. You'll just make it extra hard for users to change it. At any rate, I don't think it's HLS job to install a toolchain at all. I'm sure most people don't start with Haskell by installing HLS, but by installing GHC. |
Also, you're going to conflict with stack installing GHC automatically and possibly with cabal if it ever implements user hooks. So I don't think this is a good idea. |
Hook could be included as a first try if it exists (like in stack which will download ghc anyways if the hook is not present) The motivation will be download it for beginners who dont know much about stack, cabal or ghc and nothing about hooks. |
Not sure about that, i think people is starting to use haskell via vscode and the extension and they hit the missing toolchain. |
As stated in the descfription we would let stack download ghc and msys2 in its own. |
dont want to enter the ongoing war about what tool is in the top of the haskell toolchain graph, though 😝 another alternative could do this in the vscode extension to isolate the feature, but i think make it opt-in int the hls-wrapper and make vscode use it by default (with an opt-out) will be equivalent (and we will not have to write typescript) another one could be include hooks in hls-wrapper and use default ones in the extension |
As we are watching lately to rust land is worth to note that the rust vscode extension only requires |
Then that means vscode should install GHC, not HLS.
There's a difference between the vscode extension and the |
even doing it opt-in the wrapper? dont we want to offer the same experience for sublime, emacs or vim people with only switching a flag? it would be a little bit unfair for them or for plugin developers of such editors who will have to reimplement the logic |
I hate it when tools try and automatically install things. Inevitably it ends up becoming a (bad) package manager that doesn't interact well with the user's existing package management solutions, is opaque, and provides another source of unpredictable behaviour. I would also want to disable this immediately. However.... people do seem to really like the automatic installation of HLS by the vscode extension. So I concede that I evidently am not a 100% representative user :) Perhaps we should ask some of our users whether they would want this? |
I don't think so. VSCode users and vim users have vastly different expectations. Vim users micro-manage their plugins and settings. |
Ok @michaelpj @hasufell i've updated the description with the different alternatives and discarding being opt-out, which would be your preferred one?
Note i've pointing out some caveats here: #2251 (comment) |
sure, i dont think vim plugin will use the feature but maybe the other ones (not sure about emacs but sublime and kakoune might do) |
|
Yes, in fact what had occurred to me is that really this is something where you want to ask the user what they want upfront. I think the vscode extension just does it right now rather than asking, right? Something like: "Can't find a If we then had something similar for installing GHC I wouldn't hate it, I guess. |
And download cabal or stack if the project needs one of them? |
Right now the extension downloads hls-wrapper and hls by default if it is not in PATH and the config option with a explicit path to hls is not set. And you can even disable it entirely. There is no much other ways to tell the extension where hls is placed so i think is fine to download it by default in that case but asking a one-off question to set the configuration could be done as @hasufell suggested. It doesnt use ghcup for now. I would do the same for ghc/cabal/stack with an one-off question (using ghcup to leverage its install logic, will be crazy to reimplement it twice). I would use ghcup to install hls itself if ghcup is in PATH, preserving for now the actual behaviour. |
Ok, we are all experienced haskellers who like to have control over our setup. I would like to read more opinions about, reflecting the beginners point of view. Well sure there are beginner who will want to control it anyways. //cc @Ailrun @berberman @ndmitchell If nobody disagree will move this to the vscode extension project, to implement there the download of the toolchain using ghcup. |
Ok no beginner came here to give its point of view 😝 so i am gonna move this to the vscode extension, thanks all for the feedback! |
ghcup install hls
. It will install another hls-wrapper which maybe will replace the used one. To consider.ghcup install cabal && ghcup install ghc ${version}
, where${version}
will be the ghc version reported by the cradle or empty if it is not known, after downloading cabal itself (needed for query the ghc version)ghcup install stack
and let stack download the rest of needed tools (as with the default stack via ghcup will download ghc and/or msys2 in its own)ghcup install ghc
The feature will be triggered by default and disabled withThe feature will be disabled by default and enabled with--no-download-haskell-toolchain
--download-haskell-toolchain
Alternatives:
//cc @hasufell
The text was updated successfully, but these errors were encountered: