Let's go faster and just use the pre-built stuff in a docker container:
alias haskell='docker run -it --rm --user "$(id -u):$(id -g)" --net=host -v "$(pwd)":"/home/$USER" --workdir="/home/$USER" -e HOME="/home/$USER" haskell:8'
Pull down the most recent cabal index:
haskell cabal update
Install the scotty library:
haskell cabal install scotty
Setup our project (use defaults except the last question, say yes to the last one):
haskell cabal init
Create the main file to run the service:
Main.hs
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import Data.Monoid (mconcat)
main = scotty 3000 $
get "/:word" $ do
beam <- param "word"
html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"]
Run the service!
haskell cabal run
Curl the service!
curl 'localhost:3000'; echo