[Ur] Folds on lists of xbody

Istvan Chung istvan at vivatropolis.org
Mon May 27 20:45:18 EDT 2013


I am attempting to use List.foldl to join a list xbody:

   val a : xbody = <xml><p>Hello</p></xml>
   val b : xbody = <xml><p>World!</p></xml>
   val c = join a b
   val d = (join b (join a <xml/>))
   val e : list xbody = (a :: b :: [])
   (* All ok up to here... *)
   val f = List.foldl join <xml/> e

Which causes Ur/Web to give the (opaque to me) error message:

    Unification failure
    Expression:
    join [<UNIF:U80::{Unit}>] [<UNIF:U81::{Type}>] [<UNIF:U82::{Type}>]
     [<UNIF:U83::{Type}>]
      Have con:
    (xml <UNIF:U80::{Unit}> <UNIF:U81::{Type}> <UNIF:U82::{Type}>) ->
     (xml <UNIF:U80::{Unit}> (<UNIF:U81::{Type}> ++ <UNIF:U82::{Type}>)
       <UNIF:U83::{Type}>) ->
      xml <UNIF:U80::{Unit}> <UNIF:U81::{Type}>
       (<UNIF:U82::{Type}> ++ <UNIF:U83::{Type}>)
      Need con:
    (xml <UNIF:U80::{Unit}> <UNIF:U81::{Type}> <UNIF:U82::{Type}>) ->
     (xml <UNIF:U80::{Unit}> (<UNIF:U81::{Type}> ++ <UNIF:U82::{Type}>)
       <UNIF:U83::{Type}>) ->
      xml <UNIF:U80::{Unit}> (<UNIF:U81::{Type}> ++ <UNIF:U82::{Type}>)
       <UNIF:U83::{Type}>
    Constructor occurs check failed
    Have:  <UNIF:U81::{Type}>
    Need:  <UNIF:U81::{Type}> ++ <UNIF:U82::{Type}>

Why does this happen, and why does no such error occur for expression
[d], which seems to perform the same set of joins?

Many thanks,
-- 
Istvan Chung



More information about the Ur mailing list