3 ms·
The first 2-minute experience with a Haskell web service: curl -L https://nixos.org/nix/install | sh cat > ./script.sh <<EOF #! /usr/bin/env nix-shell
by ghostwriter 6y ago
The first 2-minute experience with a Haskell web service:
curl -L https://nixos.org/nix/install | sh
cat > ./script.sh <<EOF
#! /usr/bin/env nix-shell
#! nix-shell <nixpkgs> -i runghc -p "ghc.withPackages (x: [ x.yesod ])"
{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Yesod
data App = App
mkYesod "App" [parseRoutes|
/ HomeR GET
|]
instance Yesod App
getHomeR = return $ object ["msg" .= "Hello!"]
port = 3000
main = warp port App
EOF
chmod +x ./script.sh
./script.sh