[Ur] Simple XML Templating Problem

Burton Samograd burton.samograd at gmail.com
Thu Oct 2 15:33:06 EDT 2014


Still no luck:

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

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


Compiling gives:

/home/burton/blog/blog.ur:7:5: (to 7:30) Unification failure
Expression:  head_template "Blog Main"
  Have con:
<UNIF:B::Type -> Type> (xml ([Html = ()]) <UNIF:I::{Type}> ([]))
  Need con:
xml <UNIF:U62::{Unit}> <UNIF:U63::{Type}> <UNIF:U64::{Type}>
Kind unification failure
Have:  Type -> Type
Need:  {Type} -> Type
Incompatible kinds
Kind 1:  Type
Kind 2:  {Type}

--
Burton Samograd

On Thu, Oct 2, 2014 at 1:03 PM, maasha at gmail.com <maasha at gmail.com> wrote:

>  There was a problem with your brackets
> {t} : works for : val title : xbody = <xml></xml>
> {[t]} : works for : val title : string = "tofu is good"
>
> fun head_template (t:string) =
>     <xml><head><title>{[t]}</title></head></xml>
> and main () = return <xml>
>     {head_template "Blog Main"}
>     <body>
>
>     </body>
>     </xml>
>
> happy hacking
>
>
> On 10/02/2014 02:53 PM, Burton Samograd wrote:
>
> 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
>
>
>
>
> _______________________________________________
> Ur mailing listUr at impredicative.comhttp://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20141002/0073ba17/attachment.html>


More information about the Ur mailing list