[web-devel] strange link behavior in yesod

Chris Casinghino chris.casinghino at gmail.com
Sun Apr 10 18:55:18 CEST 2011


Hi all,

I'm running the Yesod 0.8 beta on GHC 7.0.3 and seeing some strange
behavior.  I'm a total Yesod newbie, so please forgive me if I'm
missing something obvious.

Below is a simplification of the Links example from the Yesod book.
When I run the program with "runhaskell links.hs", the link on page1
points back to page1, instead of home.

I'd be very grateful if someone could explain what I'm doing wrong.
Thanks!

--Chris Casinghino

> {-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, TemplateHaskell, OverloadedStrings #-}
> module Links where
>
> import Yesod
>
> data Links = Links
>
> mkYesod "Links" [parseRoutes|
> / HomeR GET
> /page1 Page1R GET
> |]
>
> instance Yesod Links where
>   approot _ = ""
>
> getHomeR  = defaultLayout [hamlet|<a href="@{Page1R}">Go to page 1!|]
> getPage1R = defaultLayout [hamlet|<a href="@{HomeR}">Go home!|]
>
> main :: IO ()
> main = warpDebug 3000 Links



More information about the web-devel mailing list