Last active
September 11, 2017 02:44
-
-
Save n4to4/de3d375131056063cbbe9c738bf4d8d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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