Created
March 5, 2014 23:16
-
-
Save gouf/9378815 to your computer and use it in GitHub Desktop.
my first time Yesod. チュートリアルにそって、3ページを巡回するアプリケーションを作成
This file contains 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 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