[Ur] "Invalid Link expression" when pulling a function out of a record

Adam Chlipala adamc at csail.mit.edu
Wed Feb 27 17:39:02 EST 2013


On 02/27/2013 04:55 PM, Benjamin Barenblat wrote:
> I've tried changing 'makeLink' to work on arbitrary names, as long as
> the record only has one.
>
>      fun makeLink [nm ::: Name] (r : { nm : (unit ->  transaction page) }) : xbody =
>          <xml>
>            <a link={r.nm ()}>call</a>
>          </xml>
>
>      fun main () =
>          return<xml>
>            <body>
>      	{makeLink { Target = main }}
>            </body>
>          </xml>
>
> However, attempting to compile this yields
>
>      test.ur:3:15: (to 3:22) Invalid Link expression
>      Expression UNBOUND_0.UNBOUND_0 {}
>
> I have no clue what's going on here.  What does "Invalid Link
> expression" mean?
>    

Ur/Web URLs are generated based on the names of functions that are 
called, so the compiler is fussy about expressions used to describe link 
targets.  Currently, the rules in place don't support polymorphic 
functions.  You could turn [makeLink] into a functor, with an input 
module containing [nm] as a parameter but an output module containing 
just a non-polymorphic function, and things would work.



More information about the Ur mailing list