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 6733393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:45:47+00:00 2026-05-26T10:45:47+00:00

I’m following the yesod book example about how to use monadic forms. My getRootR

  • 0

I’m following the yesod book example about how to use monadic forms. My getRootR action was taken almost verbatim from the book. I got a compiler error, stripped the quasiquote but still got the error. Below is my error message, the code as it is, followed by what I would like getRootR to look like. Any input as to what the problem might be would be much appreciated.

ghci Rocko.hs

… several “package loading”
messages pass until …

Rocko.hs:67:5:

Couldn't match type `handler'
               with `GGHandler
                       Scheduler
                       Scheduler
                       (Data.Enumerator.Iteratee Data.ByteString.Internal.ByteString IO)'
  `handler' is a rigid type variable bound by
            the type signature for getRootR :: handler RepHtml at Rocko.hs:65:1
Expected type: handler RepHtml
  Actual type: GGHandler
                 Scheduler
                 Scheduler
                 (Data.Enumerator.Iteratee Data.ByteString.Internal.ByteString IO)
                 RepHtml
Expected type: handler RepHtml
  Actual type: GHandler Scheduler Scheduler RepHtml
In the return type of a call of `defaultLayout'
In the expression:
  defaultLayout
    (addHtml
       ((Text.Blaze.Internal.preEscapedText . Data.Text.pack)
          "<p>Result: </p>"))

Failed, modules loaded: JsonParser.

>{-# LANGUAGE OverloadedStrings, TypeFamilies, QuasiQuotes,
         TemplateHaskell, MultiParamTypeClasses #-}
>import Yesod
 import Control.Applicative
 import Control.Monad
 import Data.Text (Text)
 import Data.Time
 import Yesod.Form.Jquery
 import JsonParser

 data Scheduler = Scheduler

 mkYesod "Scheduler" [parseRoutes|
 / RootR GET
 |]

 instance Yesod Scheduler where
    approot _ = ""

 instance RenderMessage Scheduler FormMessage where
    renderMessage _ _ = defaultFormMessage

 instance YesodJquery Scheduler

 data SelectedProduct = MKsp { product :: Text
                             , version :: Text
                             , requestedDate :: Day
                             } deriving Show


 productForm :: Html
             -> Form Scheduler Scheduler (FormResult SelectedProduct, Widget)
 productForm extra = do
    pInfo <- liftIO getUIdata
    let products = Prelude.map productACC $ fst pInfo
        versions = Prelude.map versionsACC $ snd pInfo
        version' = head versions
    (productRes, productView) <- mreq (radioField products) "Placeholder" Nothing
    (versionRes, versionView) <- mreq (selectField version') "Placeholder" Nothing
    (dateRes, dateView) <- mreq (jqueryDayField def
                          { jdsChangeYear = True
                          , jdsYearRange = "2011:2012"
                          }) "Schedule" Nothing
    let selectedRes = MKsp <$> productRes <*> versionRes <*> dateRes
        widget = do
           toWidget [whamlet|
  #{extra}
  <p>
     ^{fvInput productView}
     ^{fvInput versionView}
     ^{fvInput dateView}
     <input type=submit value="aint that some &^*^">
  |]

    return (selectedRes, widget)

 productACC :: ProductNames -> (Text,Text)
 productACC (MKpn pNames) = (pNames,pNames)

 versionsACC :: [ProductVersions] -> [(Text,Text)]
 versionsACC pVersions = Prelude.map vACC' pVersions
                                where vACC' (MKpv pversions') = (pversions', pversions')

 getRootR :: handler RepHtml
 getRootR = do
     ((res, widget), enctype) <- runFormGet productForm
     defaultLayout [whamlet|
 <p>Result:
 |]

 main = return ()
 -- main :: IO ()
 --main = warpDebug 3000 Scheduler `

Here’s what I would like getRootR to look like for now

>getRootR :: Handler RepHtml
 getRootR = do
   ((res, widget), enctype) <- runFormGet productForm
   defaultLayout [whamlet|
  <p>Result: #{show res}
  <form enctype=#{enctype}>
      ^{widget}
  |]
  • 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-05-26T10:45:48+00:00Added an answer on May 26, 2026 at 10:45 am

    I guess it is because you have

    getRootR :: handler RepHtml
    

    Handler should be with uppercase h.

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string

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.