I am very new to Haskell and, as you might guess, new to Yesod. I wanted to play with them as a way to learn a little more about Haskell and web development.
I have two problems, and both of them can be stupid mistakes, which I due to my lack of knowledge of Haskell:
(1) I created a scaffold site with sqlite (I am using Yesod 1.2). I tried to add only one additional line in the generated homepage.hamlet file, and this gives me an error (by the way, the site works fine without this addition). I added:
<a href=@ {AuthR LoginR}>Go to the login page
After that, I get the following error message:
Handler/Home.hs:34:11: Not in scope: data constructor `LoginR' In the result of the splice: $(widgetFile "homepage") To see what the splice expanded to, use -ddump-splices In a stmt of a 'do' block: $(widgetFile "homepage") In the second argument of `($)', namely `do { aDomId <- newIdent; setTitle "Welcome To Yesod!"; $(widgetFile "homepage") }'
Is there a way to open LoginR in other handlers / templates?
(2) Ultimately, I want to customize the look of the login page, so I tried to follow the instructions here (also thought that this could solve the above problem, as I declare my own handler in the field): http://hackological.com / blog / using-twitter-to-authenticate-in-yesod / . I basically changed the expression Foundation.hs authRoute as follows
authRoute _ = Just LoginPanelR
and then added the route:
/login LoginPanelR GET
and added a handler to Home.hs
getLoginPanelR :: Handler RepHtml getLoginPanelR = defaultLayout $(widgetFile "login")
I also created the corresponding login.hamlet file with the contents specified in the link. Then I get the following error:
Foundation.hs:100:32: Couldn't match type `App' with `Auth' Expected type: Route Auth Actual type: Route App In the first argument of `AuthR', namely `LoginPanelR' In the second argument of `($)', namely `AuthR LoginPanelR' In the expression: Just $ AuthR LoginPanelR
Could you tell me what I am doing wrong?
Thanks!