Get a Haskell development environment in Three Steps

Recently I’ve seen a few questions (a.k.a complaints) about how difficult is to set up a Haskell development environment. The paradox is that It isn’t difficult at all, and actually ghcup home page makes a decent effort to get a comprehensive guide. So I decided to write a simple guide on markdown format. Hopefully this guide can help to improve current status.

contex

I’ve been helping some newcomers to get a Haskell environment up and running, so I know this instructions work in windows and linux (Haven’t tested MacOS but should be similar to linux) and also work for cabal and stack users. Although, the guide is cabal oriented (because stack integrates poorly with hls). Also, I am using this guide to update the gitpod template for Haskell.

Problem with current status

I think the problem has roots in communication and misleading documentation.

Communication issues has been discussed in this very same place over the past few days.

I would like to point out about documentation. GHCup home page is good, but It has two major problems:

  • It does not provide a clear, opinionated path to get things up and running.
  • it is too long

In general what I’ve seen can be summarize in: “At least with python I can download pycharm and that’s it”. Most newcomers I’ve attended have either a python or javascript background (or they are students using laboratory machines with everything already prepared). For these two languages all you need to do is literally install pycharm or vscode. Many of them don’t know what a language server is because they all used to one-tool-solves-all, they don’t give a ***** for unix-philosophy and they just want to follow some step by step guide reading the least possible text. Clearly ghcup documentation do not hold this (which I don’t think is bad, but I am just stating what I’ve found out)

7 Likes

You mean in term of editor setup? Yes, that’s on purpose. Instead, I would like to link to guides that explain editor setups (like yours). I have no interest in maintaining those things on ghcup homepage myself. A wiki might be a better place, but wikis tend to bitrot.

In fact, the “First steps guide” at the end has a big button “Editor setup with HLS”, which leads to HLS docs: https://haskell-language-server.readthedocs.io/en/stable/installation.html

And that link also explains the vscode-haskell extension. So to me it appears all information is already in place. It might just have to be structured better to be more accessible.

This restructuring is really hard, especially if you already know all the ins and outs of tooling… it’s hard to put yourself into a newcomers position.

2 Likes

I think it is a very good idea to prominently suggest VSCode and the Haskell plugin (maybe on GHCup’s home page right below the main installation command?). It would be even better if we could get a single installer that installs VSCode + Haskell plugin + GHCup (+ ghc + cabal + hls) in one go.

I suspect it is hard or even impossible for GHCup to install VSCode with the Haskell plugin, but I don’t actually know. Maybe that is an option?

3 Likes

Installing plugins via command line is easy:

code --install-extension haskell.haskell

ghcup install script could easily check whether VSCode is installed and then offer to install the haskell extension.

Installing VSCode itself via ghcup is… both not easy and definitely out of scope.

Maybe the easiest solution would be for GHCup to show a link to the download page for VSCode if it is not yet installed and the user tries to install the plugin? Would that also be out of scope?

That would be making a statement about editors. Then in a month, someone will demand to put a link to neovim, emacs, …

I don’t know if this is a good idea. Again: linking to a page that has instructions for multiple popular editors and lets you easily navigate those would be ok. This could be the HLS documentation.

The provided instructions in the markdown post are indeed quite clear and this is how I recommended installing Haskell as well for newcomers :clap:

More than 500 people completed these courses on a variety of operating systems (Ubuntu, Windows, macOS, ArchLinux, Fedora, Debian, Pop!_OS and whatnot). so I can add they work more or less reliably across different systems :slightly_smiling_face:

3 Likes

As a (neo)vim and emacs user myself, I think there is broad consensus that VSCode is the path of least resistance for newcomers, especially for those who need the most guidance and for whom even reading a long page with all possible editors can already be a barrier. I wouldn’t consider that preferential treatment or a statement about editors.

4 Likes

Just to be clear: I think it’s totally fine if the HLS documentation is biased towards VSCode (in the sense that it’s more prominently suggested). There are two reasons:

  1. VSCode basically is the reference implementation of an LSP client. If it doesn’t work… what else does?
  2. we (HLS and ghcup contributors) maintain the vscode-haskell extension… so it’s tightly integrated

But this really is a matter of HLS, not of ghcup.

Just for reference, 45% of Haskellers seem to use VSCode, but 40% use VI-like editors: https://taylor.fausak.me/2021/11/16/haskell-survey-results/#s3q1. I think that’s a very clear argument that we want a proper page that says more than “install VSCode”. Editors are also not like build tools and “less is better” doesn’t really apply.

I don’t think it is productive to argue about whose responsibility it is. As mentioned at the top of this thread:

The question I’m trying to answer is: how can we achieve a similar installation experience for a Haskell IDE solution?

Having an all-in-one guide as the one linked at the top of this thread gets us part of the way there, but an installation tool would be even better. And GHCup already seems like it is more than 80% of the way there (you have done some great work already!).

I would understand it if your argument is that the maintenance cost is too high or that it is too hard to implement, but I don’t agree that delegating part of the installation procedure to the HLS documentation is sufficient. Or am I mischaracterizing your point?

Of course I’m also not suggesting that we should throw away all the other documentation and only suggest VS Code. I think we can have both a streamlined installation procedure for people who don’t want to think about editors (and who just want to start programming Haskell in an IDE) and extensive documentation for people who do want to spend time configuring their favorite editor.

1 Like

It absolutely is productive to decide where to put documentation. GHCup installs toolchain and has very little to do with editors. We already link to HLS docs in 2 places during GHCup installation:

And we link to it in the First steps guide (which strictly speaking also has no place on ghcup homepage… I added it, because I found haskell.org to be too slow and reluctant about changes, which lead to PRs going stale). HLS is the go-to implementation for IDE workflows. It makes sense to put documentation about editor configuration there. Or somewhere on haskell.org.

Since I’m also a contributor to HLS and maintainer of vscode-haskell, I think this doesn’t matter, because I’ll very likely end up contributing to that documentation anyway.

This is about structuring documentation well. I’m starting to feel ghcup page is becoming a silent alternative to haskell.org. This is concerning.

1 Like

I think we have a bit of a misunderstanding. I’m considering a streamlined installation tool (not just documentation!) for getting started with Haskell development (not just installing the toolchain!). I’m suggesting that GHCup could do more in that regard, but I guess the alternative is to build yet another layer on top of GHCup that really provides an all-in-one installation process. Do you think that is a better idea?

1 Like

Great! Why didn’t I know about this before?? :sweat_smile: I would have refer to your instructions instead of building my own haha.

3 Likes

Yes. I mean that. The reason I posted this guide here instead of opening an issue on ghcup-hs is precisely because I don’t know where this kind of documentation should be placed. But I think it should be placed somewhere

Having one click instalation would be very newcommer friendly but I don’t think is the way to go. The mantaince cost is high and a link to vscode is sufficiently easy for newcommers, so the relation value-cost isn’t that high. In other words having a three step guide is close enough to pycharm experience IMO. The problem is that currently there is no “official” resource pointing in this direction.

To clarify a little bit more. The scenario this guide comes from is:

  • Alice has very little experience configuring programming environments. Her programming background is a running Jupyter notebook hosted in her company’s server.
  • Alice is not willing to navegate across multiple pages, reading nuances about chosing one editor or another, one building tool or another, etc…
  • Alice wants a straighfoward short guide telling her exactly what to do to start her Haskell’s adventure

The core part of the guide is design to be 5 lines. Each step is very easy to follow: Installing ghcup is copy pasting a comand, installing vscode is one click, and installing the haskell extension is again one click/command.

The rest of the guide is actually provide for completeness, but it isn’t necessary for getting the job done. Personally I recommend against stack (being a stack user myself) and other editors. Nevertheless, there will be users willing to use stack or another editor so instructions should be clear and point to the right resources, but yes ghcup + ghc + cabal + vscode is by far the best default as in 2022.

The reason I am posting here is to try to find the best place to PR this guide or something very similar like @ChShersh 's. Ideally in html format and in an “official” web page, not a random github repo. Any help is appreciated

1 Like

Tbh, I do not think haskell community is big enough to support and maintain out-of-the-box solutions like that. IIRC something like Pycharm requires lots of manpower, but we do not even have enough haskell people out there to maintain critical infrastructure.

In the end, we should focus on somewhat niche populace, shouldn’t we?

Either:

  1. HLS documentation, which already contains VSCode instructions
  2. haskell dot org (e.g. in a dedicated quickstart guide or so… but haskell dot org has very low traction wrt such changes)

I agree it should be place, but It is very unlikely newcommers will search for hls documentation considering that there is a high change of them not knowing what a language server is.

um… what a pity. Maybe a quickstart guide in haskell org pointing to hls.

Well, I think I am just opening a few drafts to move this forwards. Thanks for the help.

3 Likes