Add get-ghcup installation script
The current process to install ghcup, ghc, and cabal requires several steps that could be automated. Other installers (such as rustup) have a very simple process of: curl https://sh.rustup.rs -sSf | sh
which installs the rustup
tool, cargo
(package manager), and rustc
(the compiler) all in one go. It would be really nice if we could do the same thing with ghcup :)
Overview
I imagine the end-to-end user journey for someone that's never used Haskell before should be as simple as:
$ curl https://get.ghcup.haskell.org -sSf | sh
$ source $HOME/.ghcup/env
$ echo 'source $HOME/.ghcup/env' >> $HOME/.bashrc
$ mkdir myproject && cd myproject
$ cabal init -n --is-executable
$ cabal v2-run
Details
To break things down a bit:
curl https://get.ghcup.haskell.org -sSf | sh
- Downloads and installs the most recent version of ghcup, ghc, and cabal
- Separating out the ghc install and cabal install into follow-up work as described in the README seem like unnecessary steps to me, the first thing folks are going to do when they download it is run these commands.
- If ghcup already exists it should detect this and offer to run
ghcup upgrade
- Provide instructions for how to add the necessary bin directories to your path:
echo 'source $HOME/.ghcup/env' >> $HOME/.bashrc
source $HOME/.ghcup/env
- The installation script above should create this env file containing:
export PATH="$HOME/.cabal/bin:$HOME/.ghcup/bin:$PATH"
echo 'source $HOME/.ghcup/env' >> $HOME/.bashrc
- Make sure $PATH is set properly for future sessions
- This (and the line above) should be copy and paste from the output of the install script
Implementation
I have a shell script that a wrote that accomplishes most of this now, it needs some polish but if you think this is a good idea I can send a PR and we can discuss more there.