Skip to content

Instantly share code, notes, and snippets.

@n4to4
Last active September 11, 2017 02:44
Show Gist options
  • Save n4to4/de3d375131056063cbbe9c738bf4d8d0 to your computer and use it in GitHub Desktop.
Save n4to4/de3d375131056063cbbe9c738bf4d8d0 to your computer and use it in GitHub Desktop.
executable test
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, text
, lens
, criterion
, optparse-applicative
, mtl
, wai, warp, http-types, lucid
{-# LANGUAGE OverloadedStrings, RankNTypes, FlexibleContexts #-}
module Main where
import Lucid
import Data.Text
import Network.Wai
import Network.Wai.Handler.Warp
import Network.HTTP.Types
main :: IO ()
main = do
putStrLn "localhost:3000"
run 3000 $ \_ respond ->
respond $ responseLBS status200 [] $ renderBS indexHtml
indexHtml :: Html ()
indexHtml = layoutHtml $ do
h1_ [] "Lucid"
p_ [] "Lorem"
script_ [src_ "/js/main.js"] empty
layoutHtml :: Html () -> Html ()
layoutHtml content = do
doctype_
html_ $ do
head_ $ do
title_ [] "Hello Lucid"
link_ [rel_ "stylesheet", type_ "text/css", href_ "/css/main.css"]
body_ content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment