<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Hi citizens of Ur,</div><div></div><div><br></div><div>A long while back, Adam responded in a discussion about Ur's record system  <a href="http://blog.ezyang.com/2012/04/how-urweb-records-work-and-what-it-might-mean-for-haskell/#comment-3705">http://blog.ezyang.com/2012/04/how-urweb-records-work-and-what-it-might-mean-for-haskell/#comment-3705</a></div><div><br></div><div>I'm wondering whether Ur's disjointness constraint might be used to build a record merge operator -- as needed for Relational Algebra Natural Join.</div><div><br></div><div>(I'm finding it a bit weird using `~` for disjointness: I'm so used to it being a type equality constraint in Haskell. So apologies if I stuff up. Also in the Ur materials I looked at, I don't see how to express type equality? For equality of record types I mean same set of field names, and same type of each corresponding field.)</div><div><br></div><div>Given two records of type t1, t2 with (some) fields in common, some private; let's chop their fields into projections:</div><div>t1' -- fields private to t1</div><div>t1_2 -- fields in common</div><div>t2' -- fields private to t2</div><div><br></div><div>Then we can say (treating `++` as union of fields): </div><div>t1 is [ t1' ++ t1_2 ]; </div><div>t2 is [ t1_2 ++ t2' ]; </div><div>the result of Natural Join is [ t1' ++ t1_2 ++ t2' ].</div><div><br></div><div>We also require those projections to be disjoint: </div><div>[ t1' ~ t1_2 ], [ t1' ~ t2' ], [ t1_2 ~ t2' ]</div><div><br></div><div>Those constraints uniquely 'fix' all those record types modulo ordering of names/fields in the records. Is that going to work?</div><div><br></div><div>It also feels weird using `++` for record union: again it strongly suggests Haskell's list concatenation, which is non-commutative. Perhaps Ur's `++` is non-commutative(?) It's the inbuilt semantics for `$( )`, `!` that make `++` commutative in effect(?)</div><div><br></div><div>Thank you</div><div>AntC</div></body></html>