[Ur] Running queryX1 once works; running it twice gives a compiler error

Adam Chlipala adamc at csail.mit.edu
Tue Jul 28 09:55:17 EDT 2015


On 07/28/2015 02:50 AM, Stefan Scott Alexander wrote:
> But wait! Let's do one more test:
>
> (2) If we *replace* the 2nd statement with a copy of the 1st statement 
> (and in the 2nd copy we change 'thingRows' to 'thingRows2' - and we 
> also again remove references to 'colorOptions' elsewhere in my code), 
> then the code looks like this:
>
>   thingRows <-
>     queryX1 (SELECT * FROM thing)
>     (fn r => <xml> <tr>
>                <td> {[r.TId]} </td>
>                <td> {[r.TNam]} </td>
>                <td> {[r.Color]} </td>
>              </tr> </xml>);
>
>   thingRows2 <-
>     queryX1 (SELECT * FROM thing)
>     (fn r => <xml> <tr>
>                <td> {[r.TId]} </td>
>                <td> {[r.TNam]} </td>
>                <td> {[r.Color]} </td>
>              </tr> </xml>);
>
> AND NOW WE GET THE SAME COMPILE ERROR AS PREVIOUSLY (before we did any 
> modifications):
>
>   "Some constructor unification variables are undetermined in 
> declaration".

I recommend thinking more about the meanings of the error messages, 
instead of thinking of them as magic incantations. ;)

As I wrote in my previous message, the other code that you removed 
really was the problem, and it makes sense why it would be.

Your modification (2) introduces a new problem: variable [thingRows2] is 
defined but never used, and the usage context gave crucial information 
to determine its precise type.  Without that information, its type 
contains at least one undetermined unification variable.

Why would the type be unclear from context above?  Ur/Web XML types 
include information on which form variables are bound and used.  The 
code above is not sufficient to tell which form variables may be in 
scope for the generated XHTML.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150728/f1221a59/attachment.html>


More information about the Ur mailing list