tomjaguarpaw / tilapia

Improving all Haskell's programmer interfaces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installing VSCode / Haskell Language Server

goldfirere opened this issue · comments

Last month, I tried installing VSCode and Haskell Language Server. I wrote a log of my experiences, but could not think of where to send it. This repo seems like a good place, and so I'm sending it here.

Background:

  • I am already a knowledgeable Haskeller
  • I am motivated to succeed
  • I am on MacOS 10.13.6 (which is a bit outdated, I know)

What happened:

  • I search for "install haskell". I am directed to haskell.org/platform, which describes the Haskell Platform and how to install it. I know this is wrong, so I click Downloads.
  • The Downloads page tells me to use ghcup. I follow the link to a ghcup page (using a different design than the rest of haskell.org, requiring that I double-check the URL for safety), but I am given an inscrutable curl line. I don't wish to execute, because no one has told me what the line does, other than "install Haskell". But I already have Haskell, so I don't like it.
  • After some looking around, I find that ghcup installs the Haskell Language Server. That's what I want. So I go to its GitHub page. Its installation instructions tell me to say "ghcup install hls", but I don't seem to have ghcup in my PATH. (I don't know why -- I think I used ghcup some time ago.)
  • I give up on this tack, and decide to just install VSCode, as that's what I've heard is a good way to use Haskell.
  • VSCode allows me to install support for Haskell via HLS, and so I do. The Haskell plugin is labeled as v1.6.0. It actually says "Haskell v1.6.0" when I look at the Haskell plugin, but I know better than to believe this is Haskell version 1.6.0. I assume it's HLS 1.6.0, and so I check to make sure that's the up-to-date version. But the most recent version of HLS is 1.3.0. Strange. VSCode reports that the release I have was last updated on 8/8/21, so I'm content with that. (I still don't know what actually is at version 1.6.0. But I don't really need to.)
  • I get a message that HLS 1.3.0 for GHC 8.10.1 (the GHC in my PATH) is not available on Darwin, with a link to show supported versions. (NB: I use my previous knowledge that Darwin = MacOS.)
  • The link brings me to https://github.com/haskell/vscode-haskell#supported-ghc-versions. Indeed 8.10.1 is not listed. I'd like to use 9.0.1 for my talk, but that's labeled as only limited support. The "limited" is a link, so I follow it to haskell/haskell-language-server#297, opened August 2020, and with a smattering of filled and unfilled checkboxes. I have no idea what the boxes mean for me. But I don't like the number of unfilled checkboxes here, and I'm surprised that this has been outstanding for a year.
  • So I decide to download ghc-8.10.5.
  • Searching for "download ghc" brings me to https://www.haskell.org/ghc/download.html, which works well enough, and I find a link for 8.10.5. I scroll down to get the binary for MacOS. (I've done many binary installs, an my experience is that the instructions here work well. I will fast-forward.)
  • After getting ghc-8.10.5 on my PATH, I restart VSCode. I create a new Haskell file and type x = 5. I am very pleased when a little x :: Integer appears right above my definition. I feel a distinct sense of success at conquering a wily foe: the Haskell installation process.

Really interesting experience report, it think we will able to improve some things in hls and the vscode extension thanks to. 👍
Maybe @hasufell could be insterested in the ghcup part.

VSCode allows me to install support for Haskell via HLS, and so I do. The Haskell plugin is labeled as v1.6.0. It actually says "Haskell v1.6.0" when I look at the Haskell plugin, but I know better than to believe this is Haskell version 1.6.0. I assume it's HLS 1.6.0, and so I check to make sure that's the up-to-date version. But the most recent version of HLS is 1.3.0. Strange. VSCode reports that the release I have was last updated on 8/8/21, so I'm content with that. (I still don't know what actually is at version 1.6.0. But I don't really need to.)

Versioning of the extension and server are different indeed. The extension is named "haskell" so it could drive to some confusion. Not sure what can we do here tbh, suggestions will be very welcomed!

The link brings me to https://github.com/haskell/vscode-haskell#supported-ghc-versions. Indeed 8.10.1 is not listed. I'd like to use 9.0.1 for my talk, but that's labeled as only limited support. The "limited" is a link, so I follow it to Support for GHC-9.0.1 haskell/haskell-language-server#297, opened August 2020, and with a smattering of filled and unfilled checkboxes. I have no idea what the boxes mean for me. But I don't like the number of unfilled checkboxes here, and I'm surprised that this has been outstanding for a year.

The description of the issue assumes knowledge from the user about "plugins", "formatters" and "hackage releases" which can confuse user for sure. Will update the description to try to clarify the level of support (which is actually quite complete imo)

but I am given an inscrutable curl line. I don't wish to execute, because no one has told me what the line does, other than "install Haskell"

The download page already gives you clear instructions on what to do if you don't like curl | sh. It points you to https://gitlab.haskell.org/haskell/ghcup-hs#manual-install

Which also clearly explains PATH.

Did you follow those steps?

The description of the issue assumes knowledge from the user about "plugins", "formatters" and "hackage releases" which can confuse user for sure. Will update the description to try to clarify the level of support (which is actually quite complete imo)

@goldfirere i've updated the issue description, let me know if you think it would help to take a decision about using ghc-9.0.1

@jneira

Thanks for your encouragement here!

Versioning of the extension and server are different indeed. The extension is named "haskell" so it could drive to some confusion. Not sure what can we do here tbh, suggestions will be very welcomed!

This is indeed hard. Many extensions in VSCode are given names that simply mimic what the extension supports (e.g. Jupyter, Python, Haskell). So perhaps that's a convention that I did not know. Having used VSCode now for a few weeks, I don't think I would be confused on this point today. Maybe no action to take here.

The description of the issue assumes knowledge from the user about "plugins", "formatters" and "hackage releases" which can confuse user for sure. Will update the description to try to clarify the level of support (which is actually quite complete imo)

I like the "state of support" introduction. That's very helpful. One small problem is that it says I should change only if interested in specific formatters, etc. But the checkboxes don't link to any further information. For example, the hls-class-plugin is not currently supported. I don't know what this does or whether I'm interested in it. Is there a link to further (already existing) information? (This particular one is not just the 9.0.1-readiness page. In the VSCode settings, I have "Plugin > Class: Global On", with the description "Enables type class plugin" -- even after a few weeks of use, I still don't know what this does.)

Ideally, I would think that HLS would have some sort of "table of contents", listing all the plugins for it, and linking to those plugins' descriptions. This table of contents would then make a great template for GHC-version readiness tickets, keeping links intact.

@hasufell

Yes, I agree that there are alternative instructions now, and that the alternative instructions describe how I can just install a ghcup binary (good!). These instructions might have been there when I tried this, as well (it was mid-August). A challenge with UI design is that the interesting part of your program is executed on very individualized pieces of hardware (your users' brains) -- and this hardware is very non-deterministic. Perhaps the page was and is as good as it can be -- I have no suggestions to offer, and on review today, all looks well (except for the fact that it is styled differently than the rest of haskell.org, which does give one pause during downloading, an act that requires some degree of trust). Yet the experience above really did happen. Maybe the problem is that I'm not against curl | sh per se, but I like to be told very specifically what the line will actually do. For example, does it just put the binary on my machine? Does it execute the binary, which will then ask me more questions? Will it download all of Hackage, build, and install it, requiring many hours of execution time? I don't know, and clarifying this (even in just a brief sentence) would be reassuring.

Thanks again all for your constructive responses. My post was a bit snarky in retrospect, but it expresses the genuine frustration I felt at the time.

Ideally, I would think that HLS would have some sort of "table of contents", listing all the plugins for it, and linking to those plugins' descriptions. This table of contents would then make a great template for GHC-version readiness tickets, keeping links intact.

Absolutely agree, we have some demos in the vscode extension README and hls docs but it is clearly insufficient.
Some plugins have a nice intro in their own README:

But not all has it (class plugin even dont have a README) and they are not linked in a cohesive way. We have an issue about though: haskell/haskell-language-server#2066

And you know having the issue is half of the work 😛

haskell/haskell-language-server#2066 makes me happy. Yes, having an issue is indeed half the work! It means that the problem has been identified, which is sometimes harder than fixing it. Thanks, @jneira!

These instructions might have been there when I tried this, as well (it was mid-August)

It was.

A challenge with UI design is that the interesting part of your program is executed on very individualized pieces of hardware (your users' brains) -- and this hardware is very non-deterministic.

I'm very bad at UI and frontend. I stole the design from rustup. If anyone wants to step up making haskell.org/ghcup, the README or the bootstrap-script with all it's flashy info and warning messages better, be my guest. All these things have seen a lot of tweaks over the years, because suddenly a user understood something different than was intended.

These things are indeed hard and I'm no expert on this.

Well, me neither but from the concrete feedback i can imagine:

  • A link to some ghcup docs, describing in brief what the install script does and does not (issue about add docs in readthedocs https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/233)
  • A slightly more prominent link (but not equal to main one) to alternative ways to install it for people who dont like curl script.sh | sh

I think this one can be closed. Thanks!