Skip to content

Instantly share code, notes, and snippets.

@friedbrice
Forked from itsuart/main.hs
Created July 18, 2022 17:40
Show Gist options
  • Save friedbrice/d81f6692a845287bd67f4891e8a52761 to your computer and use it in GitHub Desktop.
Save friedbrice/d81f6692a845287bd67f4891e8a52761 to your computer and use it in GitHub Desktop.
Hello world Yesod example.
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-}
import Yesod
import Yesod.Core.Handler
data HelloWorld = HelloWorld
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
|]
instance Yesod HelloWorld
content = take (3 * 1024) $ repeat 'a'
getHomeR :: Handler RepHtml
getHomeR = hamletToRepHtml [hamlet|
$doctype 5
<html lang="en">
<head>
<body>
<p>#{content}
|]
main :: IO ()
main = warp 3000 HelloWorld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment