I would actually use the installer script:
sudo curl -sSL https://get.haskellstack.org/ | sh
but an older version is on official sources as well (better to the upgrade after)
sudo apt install haskell-stack
stack upgrade
stack update
stack new HelloHaskell scotty-hello-world
cd HelloHaskell
this will download a simple web-server example (really vanilla - no fancy folder setup, tests or anything)
stack setup
this will get GHC and everything it needs to build the project (the cd
above is important) - usually
you only have to do this once (as long as you don't switch to a higher LTS snapshot version that comes
with a different GHC-version)
stack build
this will start downloading the dependencies and compile everything - and this can take some time and will take every resource it can get - maybe we have to do something here - but on a desktop this is no problem and after a while you should have it build
(btw: this is caching dependencies on your local system - so on a developer machine this will run really quick for your second project)
stack exec HelloHaskell
if you browse to localhost:3000 you should see Scotty, me up!
(Ctrl-C
when you are done to exit the server)
stack install
this will copy the executable to ~/.local/bin
which is usually in the path
stack clean
that will remove most of the temp files - if you want you can do
rm .stack-work -rf
to remove the rest as well (but most of the downloaded compiled stuff is in ~/.stack
still)
and it should still work if started
~/.local/bin/HelloHaskell
that's it