moduleLanguage.Syntactic.Interpretation.EqualitywhereimportData.HashimportLanguage.Syntactic.Syntax-- | Equality for expressionsclassEqualityexprwhere-- | Equality for expressions---- Comparing expressions of different types is often needed when dealing-- with expressions with existentially quantified sub-terms.equal::expra->exprb->Bool-- | Computes a 'Hash' for an expression. Expressions that are equal-- according to 'equal' must result in the same hash:---- @equal a b ==> exprHash a == exprHash b@exprHash::expra->HashinstanceEqualitydom=>Equality(ASTdom)whereequal(Syma)(Symb)=equalabequal(s1:$a1)(s2:$a2)=equals1s2&&equala1a2equal__=FalseexprHash(Syma)=hashInt0`combine`exprHashaexprHash(s:$a)=hashInt1`combine`exprHashs`combine`exprHashainstanceEqualitydom=>Eq(ASTdoma)where(==)=equalinstance(Equalityexpr1,Equalityexpr2)=>Equality(expr1:+:expr2)whereequal(InjLa)(InjLb)=equalabequal(InjRa)(InjRb)=equalabequal__=FalseexprHash(InjLa)=hashInt0`combine`exprHashaexprHash(InjRa)=hashInt1`combine`exprHashainstance(Equalityexpr1,Equalityexpr2)=>Eq((expr1:+:expr2)a)where(==)=equal