1 import Base 2 3 # Experimental exact codepoint equality. No ordering or reconstructed input pair. 4 def equal_walk(a: String,b: String,same: Bool) -> Bool: 5 match a b: 6 case SNil{} SNil{}: same 7 case SNil{} SCon{_,_}: False{} 8 case SCon{_,_} SNil{}: False{} 9 case SCon{a,as} SCon{b,bs}: equal_walk(as,bs,Bool.and(same,Char.is_eq(a,b))) 10 11 def equal(a: String,b: String) -> Bool: 12 equal_walk(a,b,True{}) 13 14 def access_equal(xs: List<&2,String>,ys: List<&2,String>) -> Bool: 15 match xs ys: 16 case Nil{} Nil{}: True{} 17 case Nil{} Con{_,_}: False{} 18 case Con{_,_} Nil{}: False{} 19 case Con{x,xs} Con{y,ys}: Bool.and(equal(x,y),access_equal(xs,ys)) 20 21 def registration_equal(id: U32,name: String,access: List<&2,String>,otherId: U32,otherName: String,otherAccess: List<&2,String>) -> Bool: 22 Bool.and(U32.is_eq(id,otherId),Bool.and(equal(name,otherName),access_equal(access,otherAccess)))