[Ur] Invalid Link expression (again)

Sergey Mironov grrwlf at gmail.com
Thu Aug 8 17:24:32 EDT 2013


2013/8/9 Sergey Mironov <grrwlf at gmail.com>:
> 2013/8/9 Adam Chlipala <adamc at csail.mit.edu>:
>> On 08/08/2013 04:33 PM, Sergey Mironov wrote:
>>>
>>> Hi. I've run into the same problem when passing link generator as an
>>> argument (see 'template' function at [1]). Is there any way to help Ur
>>> in generating correct link without using functors? Maybe build<a></a>
>>> explicitly using xml values like
>>>
>>> fun makeLink f =
>>>    let a = xml ... black magic .. in a
>>>
>>> [1]  - https://github.com/grwlf/foocms/blob/master/tst/room2/main.ur
>>>
>>
>>
>> There's a good chance this will work fine if you just swap the order of the
>> first two arguments to [template].  The compiler auto-specializes functions
>> to statically known _prefixes_ of their arguments, so if the [state] isn't
>> statically known, your current version will fail to get specialized to a
>> form without first-class function arguments, while the swapped version might
>> succeed.
>
> (sorry for not replying to all)
>
> No, no luck here. I've updated [1] to the version with arguments swapped
>
> *update*
>
> I've just noticed that my version of urweb was not the latest
> (20120807). After updating to latest, urweb no longer unifies [1]. It
> says (*see below*). Do we have some canges there ?
>
>
> [grwlf at greyblade ~/proj/foocms/tst/room2 ]$ urweb -dbms sqlite -dumpTypes app
> /home/grwlf/proj/foocms/tst/room2/main.ur:13:27: (to 13:33) Unification failure
> Expression:
> fn reload :
>  {Lang : string} -> transaction (xml ([Html = ()]) ([]) ([])) =>
>  fn st : {Lang : string} =>
>   fn body :
>    {} ->
>     tag <UNIF:U149::{Type}> ([Html = ()])
>      (([Body = ()]) ++ <UNIF:U216::{Unit}>) <UNIF:U152::{Type}>
>      <UNIF:X::{Type}> =>
>    ...

Fix it by changing template's argument name from 'body' to 'b' helps,
looks new compiler introduces some name clash. Original problem still
exist. I can't use first-class function as a link expression.



More information about the Ur mailing list