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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:34:54+00:00 2026-05-28T15:34:54+00:00

I tried modifying a Yesod project, and came across a weird error. First I

  • 0

I tried modifying a Yesod project, and came across a weird error. First I will present the working form code, and the bare-bones broken code with error message.

type PForm x = ProductConfig ->
Html ->
MForm ReScheduler ReScheduler (FormResult x, Widget)

working code next

productForm :: PForm SelectedProduct
productForm config extra = do
   let pInfo' = pInfo config
       aDays' = aDays config
       products = (catMaybes . pNametoText) pInfo'
       versions' = map consVersionPair pInfo'
   productInfo <- mapM generateSelectFields versions'
   (dateRes, dateView) <- mreq (selectField aDays') "placeHolder" Nothing
   (mailRes, mailView) <- mreq emailField "E-Mail Address" Nothing
   (noteRes, noteView) <- mreq textareaField
                               "Notes"
                               Nothing
   let productVersion = reduceFormResults $
                        map flagSelected $
                        map fst productInfo

       versionViews = map snd productInfo
   let widget =
          toWidget $(widgetFile "firmware") :: Widget


   return (makeSelected productVersion dateRes mailRes noteRes, widget)

The above code works fine. Here’s the broken code, followed by the error and some observations.

type RForm x = [KeyJobPair] ->
Html ->
MForm ReScheduler ReScheduler (FormResult x, Widget)

statusForm :: RForm ModData
statusForm kjPairs extra = do
--    let bPairs = buttonPairs kjPairs
--        statusPairs = map (pack . show &&& id) $
--                      ([minBound .. maxBound] :: [Status])
--    (jobRes,jobView) <- mreq (radioField bPairs) "Scheduled Jobs" Nothing
--    (mailRes, mailView) <- mreq emailField "E-Mail Address" Nothing
--    (noteRes, noteView) <- mreq textareaField "Notes" Nothing
--    (statusRes, statusView) <- mreq (selectField statusPairs) "Status" Nothing
--    let widget = toWidget [hamlet|<p> testing |]
    let widget = (toWidget $(widgetFile "status" )) :: Widget
    return (ModData <$> undefined <*> undefined <*> undefined, widget)


Handler/Manager.hs:109:19:
 No instance for (ToWidget
               ReScheduler ReScheduler (GGWidget master0 m0 ()))
  arising from a use of `toWidget'
Possible fix:
  add an instance declaration for
  (ToWidget ReScheduler ReScheduler (GGWidget master0 m0 ()))
In the expression: (toWidget ($(widgetFile "status"))) :: Widget
In an equation for `widget':
    widget = (toWidget ($(widgetFile "status"))) :: Widget
In the expression:
  do { let widget = ...;
       return
         (ModData <$> undefined <*> undefined <*> undefined, widget) }

Note the commented out hard-coded hamlet code. This compiles fine. This leads me to believe the problem lies with widgetFile, not toWidget. I noted in the Yesod blog, that sometimes widgetFile wants an explicit :: Widget type signature. I haven’t been able to get this to work. Maybe this is just a syntax problem. Feedback would be welcome. In the meantime I can just use hardcoded Hamlet.

  • 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-28T15:34:55+00:00Added an answer on May 28, 2026 at 3:34 pm

    This was a syntax issue. It was a matter of proper placement of the type signature.

    let widget = toWidget ($(widgetFile "status") :: Widget)

    This is correct.

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

Sidebar

Related Questions

Autoconf has gotten me stumped. I have tried modifying the COMPILE in Makefile.in as
How can I disable selecting in a WPFTooklit's DataGrid ? I tried modifying the
I tried modifying the second property, but didn't work. Basically I wanna do: datetime.now().second
How can I add a silverlight-3.0 target framework to NAnt? I tried modifying the
I tried modifying the php.ini file (error_reporting = E_ALL & ~E_DEPRECATED), but with no
I'm using EF4.1 in code-first style to persist POCO objects for a small ASP.NET
For a project I am working on, I am trying to do the following
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of
Tried following the instructions here: How to use Google app engine with my own

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.