[Ur] Unification failure when duplicating result of a monadic XML generator

Sergey Mironov grrwlf at gmail.com
Sat Jul 19 14:49:57 EDT 2014


Hi.

Here is the issue I've faced recently. The code below failed to
compile with 'Unification failure' (full text is below the program).
Looks like a bug, please check!
Sorry if it is a duplicate, quick search shows no matches for such a
problem for me.

Regards,
Sergey

--

fun mkrow [o ::: {Unit}] [inp ::: {Type}] [frm ::: {Type}] [o ~
[Table,Tr]] (x:xml (o++[Tr]) inp frm) :
  transaction (xml (o++[Table]) inp frm) =
    return <xml><tr>{x}</tr></xml>

fun main {} =
  r <- mkrow (<xml><td>an item</td></xml>);
  return <xml>
    <head/>
    <body>
    <table>
      {r}
      {r} (* <--- LINE 26 *)
    </table>
    </body>
  </xml>

--
The error message:


/home/grwlf/proj/urbugs/XML.ur:26:3: (to 27:8) Unification failure
Expression:
Basis.join [<UNIF:U232::{Unit}>] [<UNIF:U233::{Type}>] [[]]
 [<UNIF:U235::{Type}>]
 (Basis.cdata [<UNIF:U232::{Unit}>] [<UNIF:U233::{Type}>] "\n")
 (Basis.join [<UNIF:U232::{Unit}>] [<UNIF:U233::{Type}>] [[]]
   [<UNIF:U235::{Type}>]
   (Basis.cdata [<UNIF:U232::{Unit}>] [<UNIF:U233::{Type}>] "      ")
   (Basis.join [<UNIF:U232::{Unit}>] [<UNIF:U233::{Type}>]
     [<UNIF:U235::{Type}>] [[]] r
     (Basis.join [<UNIF:U232::{Unit}>]
       [<UNIF:U233::{Type}> ++ <UNIF:U235::{Type}>] [[]] [[]]
       (Basis.cdata [<UNIF:U232::{Unit}>]
         [<UNIF:U233::{Type}> ++ <UNIF:U235::{Type}>] "\n")
       (Basis.cdata [<UNIF:U232::{Unit}>]
         [<UNIF:U233::{Type}> ++ <UNIF:U235::{Type}>] "    "))))
  Have con:
xml <UNIF:U232::{Unit}> <UNIF:U233::{Type}> <UNIF:U235::{Type}>
  Need con:
xml <UNIF:U232::{Unit}> (<UNIF:U233::{Type}> ++ <UNIF:U235::{Type}>)
 <UNIF:U229::{Type}>
Constructor occurs check failed
Have:  <UNIF:U233::{Type}>
Need:  <UNIF:U233::{Type}> ++ <UNIF:U235::{Type}>

PS Removing line 26 a well as inserting [r2 <- mkrow (...);] followed
by changing line 26 to [{r2}] brings program back to working.



More information about the Ur mailing list