Re:Reflections on Using Haskell for My Startup
by ghostwriter on Friday February 19, 2021 @05:20PM
(#26198767)
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
That doesn’t make React great nor solve all of the issues that lie between minute 1 and v0.1 in production, but the startup is smooth and painless (for me who comes from C/C++/C#/SQL, and my javascript is at a level where beginners can still help me).