[web-devel] [Yesod] Nesting widgets

Aren Olson reacocard at gmail.com
Mon Jun 6 19:22:04 CEST 2011


On Mon, Jun 6, 2011 at 00:41, Mark Bradley <barkmadley at gmail.com> wrote:
> You should try including the widget using the ^{} syntax instead of
> the ${} syntax.

Doesn't appear to work. I tried this:

blockW ::  Widget ()
blockW = do
    contents <- do
        addHamlet [hamlet|example|]
    addHamlet [hamlet|
<div
    ^{contents}|]

and ghc just gives me this error:

    Couldn't match type `()'
                   with `(Route ReacocardNet
                          -> [(Data.Text.Internal.Text,
Data.Text.Internal.Text)]
                          -> Data.Text.Internal.Text)
                         -> Html'
    In the return type of a call of
`hamlet-0.8.2:Text.Hamlet.Quasi.toHamletValue'
    In the first argument of `addHamlet', namely
      `hamlet-0.8.2:Text.Hamlet.Quasi.toHamletValue
         (do { (hamlet-0.8.2:Text.Hamlet.Quasi.htmlToHamletMonad
              . preEscapedString)
                 "<div>";
               hamlet-0.8.2:Text.Hamlet.Quasi.fromHamletValue contents;
               (hamlet-0.8.2:Text.Hamlet.Quasi.htmlToHamletMonad
              . preEscapedString)
                 "</div>" })'
    In the expression:
      addHamlet
        (hamlet-0.8.2:Text.Hamlet.Quasi.toHamletValue
           (do { (hamlet-0.8.2:Text.Hamlet.Quasi.htmlToHamletMonad
                . preEscapedString)
                   "<div>";
                 hamlet-0.8.2:Text.Hamlet.Quasi.fromHamletValue contents;
                 (hamlet-0.8.2:Text.Hamlet.Quasi.htmlToHamletMonad
                . preEscapedString)
                   "</div>" }))



More information about the web-devel mailing list