Skip to content

Instantly share code, notes, and snippets.

@friedbrice
Forked from itsuart/main.hs
Created July 18, 2022 17:40
Embed
What would you like to do?
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