Skip to content

Instantly share code, notes, and snippets.

@gouf
Created March 5, 2014 23:16
Show Gist options
  • Save gouf/9378815 to your computer and use it in GitHub Desktop.
Save gouf/9378815 to your computer and use it in GitHub Desktop.
my first time Yesod. チュートリアルにそって、3ページを巡回するアプリケーションを作成
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses,
TemplateHaskell, OverloadedStrings #-}
import Yesod
data Links = Links
mkYesod "Links" [parseRoutes|
/ HomeR GET
/page1R Page1R GET
/page2R Page2R GET
|]
instance Yesod Links
getHomeR = defaultLayout [whamlet|<a href=@{Page1R}>Go to page 1!|]
getPage1R = defaultLayout [whamlet|<a href=@{Page2R}>Go to page 2!|]
getPage2R = defaultLayout [whamlet|<a href=@{HomeR}>Go home!|]
main = warpDebug 3000 Links
{- and excute runhaskell filename.hs in terminal -}
{- access http://localhost:3000/ yay! -}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment