Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9152231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:59:29+00:00 2026-06-17T11:59:29+00:00

Please, consider the following three pages that are very similar. {-# LANGUAGE OverloadedStrings, TypeFamilies,

  • 0

Please, consider the following three pages that are very similar.

{-# LANGUAGE OverloadedStrings, TypeFamilies, QuasiQuotes,
         TemplateHaskell, MultiParamTypeClasses #-}
import Yesod
import Control.Applicative
import Data.Text (Text)
import Text.Hamlet

data Example = Example

mkYesod "Example" [parseRoutes|
/ RootR GET
/page PageR GET
/page2 Page2R GET
|]

instance Yesod Example

getRootR :: GHandler sub Example RepHtml
getRootR = do
    defaultLayout [whamlet|
$doctype 5
<html>
   <head>
     <title>Tutorial, hello root
   <body>
     <h1 id="greeting">Hello root
|]


getPageR :: GHandler sub Example RepHtml
getPageR = defaultLayout $ do
    toWidgetHead [hamlet| <meta charset="utf-8"> |]
    setTitle "hello page"
    toWidget [hamlet|
<h1 id="greetings2">Hello page
|]

getPage2R :: GHandler sub Example RepHtml
getPage2R = defaultLayout $ do
    toWidget [hamlet|
$doctype 5
<html>
   <head>
     <title>Tutorial, hello page2
   <body>
     <h1 id="greeting">Hello page2
|]


main :: IO ()
main = warpDebug 3000 Example

RootR and page2 give the same output (I mean tags & structure) while “page” differ’s a bit from the two. The outputs are, first “root” & “page2”:

<!DOCTYPE html>
<html><head><title></title></head><body><!DOCTYPE html>
<html><head><title>Tutorial, hello page2</title>
</head>
<body><h1 id="greeting">Hello page2</h1>
</body>
</html>
</body></html>

while the output of “page” is

<!DOCTYPE html>
<html><head><title>hello page</title><meta charset="utf-8"> </meta>
</head><body><h1 id="greetings2">Hello page</h1>
</body></html>

Why there are the extra & -tags in the “root” & “page2”? Should I add something into the code or take something away?

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:59:31+00:00Added an answer on June 17, 2026 at 11:59 am

    The default-layout function already contains doctype etc… and you are adding it again in root and page2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider the following three .NET types: I have an interface, an abstract class,
I have an app that's about presenting fictional simplified cities. Please consider the following
Please consider the following piece of code, which throws three different exceptions (namely, System.Configuration.ConfigurationErrorsException
Please consider following example: The source image consists of 6 areas that need to
Consider the following three lines of Mathematica code and note that input line 1
Please consider the following three simplified files: student.h: #ifndef STUDENT_H #define STUDENT_H #include course.h
Please consider the following code fragment: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.lang.reflect.InvocationTargetException;
I know, this is very simple for you guys. Please consider the following code:
Please consider following code: 1. uint16 a = 0x0001; if(a < 0x0002) { //
Please consider the following code: mpz_t x, n, out; mpz_init_set_ui(x, 2UL); mpz_init_set_ui(n, 7UL); mpz_init(out);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.