<div dir="ltr"><div>Looks like I have to take better care of my variable naming to prevent clashes.  <br><br></div>Thanks.<br><br>Burton<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 3, 2014 at 1:33 PM, mutaamba maasha <span dir="ltr"><<a href="mailto:maasha@gmail.com" target="_blank">maasha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
(* It seems the problem was the naming of the<br>
   query result, the query result was colliding<br>
   with the table.  Let me know if this was the<br>
   case and if the code below helps.<br>
<br>
   Happy hacking<br>
*)<br>
<br>
(* adding the needed styles *)<br>
style topbar<br>
<span class="">style postsList<br>
style post<br>
style postTitle<br>
style postAuthor<br>
style postBody<br>
style postBottom<br>
style postComments<br>
style postDate<br>
<br>
</span><span class="">table posts : { Id : int, Title : string, Body : string, Created : time }<br>
      PRIMARY KEY Id<br>
table userIdToPostIds : { UserId : int, PostId : int }<br>
      PRIMARY KEY UserId<br>
table users : { Id : int, Username : string }<br>
      PRIMARY KEY Id<br>
<br>
</span>(* Adding this here so it compiles *)<br>
val blogName : string = "The finest culinary selections from the land<br>
of tofu."<br>
(* Using modules to so everything fits in one<br>
   file.  If you are curious about modules you<br>
   can find out more about them here :<br>
   <a href="http://www.impredicative.com/ur/tutorial/intro.html" target="_blank">http://www.impredicative.com/ur/tutorial/intro.html</a><br>
   You want to remove this because you have the<br>
   files page.ur*<br>
*)<br>
signature PAGE = sig<br>
    val page' : string -> xbody -> page<br>
end<br>
structure Page : PAGE = struct<br>
    fun page' (t : string) (b : xbody) : page=<br>
        <xml><br>
          <head><title>{[t]}</title></head><br>
          <body><br>
            {[b]}<br>
          </body><br>
        </xml><br>
end<br>
(* The end of the module code/code you should remove *)<br>
<span class=""><br>
<br>
fun blog () : transaction page =<br>
</span>    (* Changed the name of the query result - this is most likely<br>
       what is was causing your problem. *)<br>
    post_query_1 <- queryX (SELECT Posts.Title, Posts.Body,<br>
<span class="">Users.Username, Posts.Created<br>
                            FROM posts, users, userIdToPostIds<br>
                            WHERE users.Id = userIdToPostIds.UserId<br>
                              AND posts.Id = userIdToPostIds.PostId)<br>
                           (fn row => post' row.Posts.Title<br>
row.Posts.Body row.Users.Username row.Posts.Created);<br>
</span>    (* changed the name of the query result *)<br>
    post_query_2 <- queryX (SELECT Posts.Title, Posts.Body,<br>
Users.Username,Posts.Created<br>
<span class="">                            FROM posts, users, userIdToPostIds<br>
                            WHERE users.Id = userIdToPostIds.UserId<br>
                              AND   posts.Id = userIdToPostIds.PostId)<br>
                           (fn row => post' row.Posts.Title<br>
row.Posts.Body row.Users.Username row.Posts.Created);<br>
    return (Page.page' blogName<br>
                       <xml><br>
                         {topbar' ()}<br>
</span>                         {posts' post_query_1}<br>
                         {posts' post_query_2}<br>
<span class="">                       </xml>)<br>
<br>
and topbar' () : xbody =<br>
    <xml><div class="topbar">{[blogName]}</div></xml><br>
</span>(* added type information here *)<br>
and posts' (posts : xbody) : xbody =<br>
<span class="">    <xml><div class="postsList"><br>
    {posts}<br>
     </div></xml><br>
</span>(* Used the code from the previous email<br>
   ... I am going to guess it is what you<br>
   have. *)<br>
<span class="">and post' (title : string)<br>
          (body : string)<br>
</span>          (username : string)<br>
          (created : time) : xbody =<br>
<span class="">    let<br>
        val numComments = 0<br>
    in<br>
        <xml><br>
          <div class="post"><br>
            <div class="postTitle">{[title]}</div><br>
</span>            <div class="postAuthor">{[username]}</div><br>
<span class="">            <div class="postBody">{[body]}</div><br>
            <div class="postBottom"><br>
              <div class="postComments"><br>
                <a link={comments ()}>{[numComments]} comments</a><br>
              </div><br>
              <div class="postDate">{[created]}</div><br>
            </div><br>
          </div><br>
        </xml><br>
    end<br>
</span><span class="">and comments () : transaction page = error <xml>error : comment<br>
function not implemented</xml><br>
<br>
<br>
</span>fun main () = return <xml></xml><br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1<br>
<br>
iQIcBAEBAgAGBQJULvn0AAoJEHxRxnzR1VWyyx4QALnOK3VgRpYNWK6wgBUxkPyz<br>
R+rKe0Vq0KCgzF3MjjyQPLaxwTxdfbg9gaXVZyXkpDnX8RIOhySYFmNOsN6BHGu3<br>
f8I4uvtS+N4Wsa4FjHzmY35XoyGiDlki6kbE+Yw8Myp7Jv2iY+FXXuQvumS83Wvr<br>
JXlujVROxY+Iglsqsu3iAh5btw+VaBaNC2SQUQLHrrIeZTvUOsIS5A0+MW7SQn5p<br>
6Aj77EDtbA2k0xpCyAADZ54UrSvzHFrMnLEheHAoLjAufNdrzl5+dyFyZukJRndg<br>
y/cc4dUgkqZhX/wsDEbMBkTqbW1R+vZvNxX0+lUSqDc53LxNYwDQQGgIuVrAqKBf<br>
yom/3IbvoS4Nkt1MF/2qZU7bptXK59rpBbWTk9zt00FO/nsf2/zR+nDU6Os6rkST<br>
4DUTmBGOcGd9/e1RO6UdK819PoVVPOXdy7JsAyzHacp3aTMH3gEkAHia7wAsb/Iz<br>
wnljBwssuNOPY1vT3s4ul8BXDRCclOsg1cb66EedFiGEnZW1PyD1mYvWeRUjR4IK<br>
CzRa3xpsliE5XisYuZqEoplQ3gaovPInJ7CZEG3k8w350ts+D85VU2WqKATIG2gr<br>
gTi9SzzqlTlIS/H2dmlNwvMsEJG38byXuCZQar0ElX7wVg8nANlv4xqAEjIbJ+YH<br>
039UXNim4rX2XSgGmg4P<br>
=6vna<br>
-----END PGP SIGNATURE-----<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>