<div dir="ltr"><div><div><div>More growing pains.  I've taken my example a bit further to:<br><br>style footer<br>style header<br><br>fun head_tmpl (_title:string) =<br>    <xml><head><title>{[_title]}</title></head></xml><br><br>fun header_tmpl () : xbody = <xml><div class="header">header</div></xml><br>fun footer_tmpl () : xbody = <xml><div class="footer">footer</div></xml><br><br>fun body_tmpl (body_xml:xbody) =<br>    <xml><body><br>    {header_tmpl ()}<br>    {body_xml}<br>    {footer_tmpl ()}<br>    </body></xml><br><br>fun page (title:string, body:xbody) =<br>    <xml><br>    {head_tmpl title}<br>    {body_tmpl body}<br>    </xml><br>    <br>fun main () : transaction page = <br>    return (page "BlogMain" <xml/>)<br><br></div>There's a problem with the main function even with the type decleration:<br><br>urweb blog<br>/home/burton/blog/blog.ur:24:17: (to 24:27) Unification failure<br>Expression:  "BlogMain"<br>  Have con:  string<br>  Need con: <br>string * (xml ([Dyn = (), MakeForm = (), Body = ()]) ([]) ([]))<br>Incompatible constructors<br>Have:  string<br>Need: <br>string * (xml ([Dyn = (), MakeForm = (), Body = ()]) ([]) ([]))<br>/home/burton/blog/blog.ur:24:12: (to 24:27) Unification failure<br>Expression:  page "BlogMain"<br>  Have con:  xml ([Html = ()]) ([]) ([])<br>  Need con:  <UNIF:U344::Type> -> <UNIF:U345::Type><br>Incompatible constructors<br>Have:  xml ([Html = ()]) ([]) ([])<br>Need:  <UNIF:U344::Type> -> <UNIF:U345::Type><br><br></div>Still learning the basics but I think once I get over the learning curve things will go a quite a bit smoother.<br><br>--<br></div>Burton Samograd<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 1:56 PM, Sergey Mironov <span dir="ltr"><<a href="mailto:grrwlf@gmail.com" target="_blank">grrwlf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2014-10-02 23:33 GMT+04:00 Burton Samograd <<a href="mailto:burton.samograd@gmail.com">burton.samograd@gmail.com</a>>:<br>
> Still no luck:<br>
><br>
> fun head_template (_title:string) =<br>
>     return <xml><head><title>{[_title]}</title></head></xml><br>
><br>
> fun main () = return <xml><br>
>     {head_template "Blog Main"}<br>
>     <body><br>
>     </body><br>
>     </xml><br>
<br>
</span>The error is caused by the type mismatch. <xml>{f x}</xml> works only<br>
for pure functions f. Pure functions usually don't mention<br>
'transaction' in their type signatures, nor they use 'return' keyword<br>
in their bodies. Your code snippet have two problems: 1) unspecified<br>
type for [main] and 2) 'return' keyword in [head_template] conflicting<br>
with <xml>{..}</xml> call. Try this code instead:<br>
<span class=""><br>
 fun head_template (_title:string) =<br>
</span><span class="">     <xml><head><title>{[_title]}</title></head></xml><br>
<br>
</span> fun main () : transaction page = return <xml><br>
<span class="">     {head_template "Blog Main"}<br>
     <body><br>
     </body><br>
     </xml><br>
<br>
</span>Regards,<br>
Sergey<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com">Ur@impredicative.com</a><br>
<a href="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" target="_blank">http://www.impredicative.com/cgi-bin/mailman/listinfo/ur</a><br>
</div></div></blockquote></div><br></div>