[Ur] Building site templates

Adam Chlipala adamc at impredicative.com
Sun Dec 11 09:14:37 EST 2011


James Parker wrote:
> I'm getting the error "Can't resolve type class instance" when I 
> attempt to do:
>
> return <xml> … {[searchBox ()]} … </xml>
>
> searchBox is defined as:
>
> and searchBox () : transaction xbody = return <xml> … </xml>

There are two issues here.

First, [searchBox] is "in the [transaction] monad."  That means you 
can't just drop a call to it into a page.

Second, the "{[ ... ]}" notation is for applying conversion from an 
arbitrary type to text via the [show] type class.  In contrast, above 
you are trying to insert a literal piece of XML, which instead uses the 
"{ ... }" notation.

So, you will want code more like this:
     x <- searchBox ();
     return <xml> … {x} … </xml>



More information about the Ur mailing list