[Ur] Simple XML Templating Problem

Burton Samograd burton.samograd at gmail.com
Thu Oct 2 14:53:59 EDT 2014


Hi,

I'm trying what I think should be a trivial thing but I can't get this
to compile:

fun head_template (title:string) =
    return <xml><head><title>{title}</title></head></xml>

and main () = return <xml>
    {head_template "Blog Main"}
    <body>
    </body>
    </xml>

I'm trying to create XML templates and return them from functions to
help break up my pages into managable pieces (common header, footer,
etc).

When I compile I get the following mass of errors:

urweb blog
/home/burton/blog/blog.ur:7:26: (to 7:32) Unification failure
Expression:  title
  Have con:  string
  Need con:  <UNIF:U23::Type> -> <UNIF:U24::Type>
Incompatible constructors
Have:  string
Need:  <UNIF:U23::Type> -> <UNIF:U24::Type>
/home/burton/blog/blog.ur:7:30: (to 7:35) Unification failure
Expression:  title
  Have con:  string
  Need con:
xml <UNIF:U6::{Unit}> <UNIF:U8::{Type}> <UNIF:U10::{Type}>
Incompatible constructors
Have:  string
Need:  xml <UNIF:U6::{Unit}> <UNIF:U8::{Type}> <UNIF:U10::{Type}>
/home/burton/blog/blog.ur:10:5: (to 10:30) Unification failure
Expression:  head_template "Blog Main"
  Have con:
<UNIF:D::Type -> Type>
 (xml ([Html = ()]) (<UNIF:U7::{Type}> ++ <UNIF:U8::{Type}>)
   (<UNIF:U9::{Type}> ++ <UNIF:U10::{Type}>))
  Need con:
xml <UNIF:U57::{Unit}> <UNIF:U58::{Type}> <UNIF:U59::{Type}>
Kind unification failure
Have:  Type -> Type
Need:  {Type} -> Type
Incompatible kinds
Kind 1:  Type
Kind 2:  {Type}

I'm using the latest download release available from the main website.

--
Burton Samograd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20141002/fb99bf84/attachment.html>


More information about the Ur mailing list